|
|
@@ -23,51 +23,51 @@ classdef Channel |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function s = get.state(ch) |
|
|
function s = get.state(ch) |
|
|
s = ch.scope.query(ch.CHAN('state?')); |
|
|
|
|
|
|
|
|
s = ch.CHAN('state?'); |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function out = get.coupling(ch) |
|
|
function out = get.coupling(ch) |
|
|
out = ch.scope.query(ch.CHAN('coup?')); |
|
|
|
|
|
|
|
|
out = ch.CHAN('coup?'); |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function out = get.bandwidth(ch) |
|
|
function out = get.bandwidth(ch) |
|
|
out = ch.scope.query(ch.CHAN('band?')); |
|
|
|
|
|
|
|
|
out = ch.CHAN('band?'); |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function out = get.offset(ch) |
|
|
function out = get.offset(ch) |
|
|
out = ch.scope.query(ch.CHAN('offs?')); |
|
|
|
|
|
|
|
|
out = ch.CHAN('offs?'); |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function out = get.scale(ch) |
|
|
function out = get.scale(ch) |
|
|
out = ch.scope.query(ch.CHAN('scal?')); |
|
|
|
|
|
|
|
|
out = ch.CHAN('scal?'); |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function out = get.label(ch) |
|
|
function out = get.label(ch) |
|
|
out = ch.scope.query(ch.CHAN('lab?')); |
|
|
|
|
|
|
|
|
out = ch.CHAN('lab?'); |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function ch = set.state(ch,in) |
|
|
function ch = set.state(ch,in) |
|
|
ch.scope.write(ch.CHANsend('state',in)); |
|
|
|
|
|
|
|
|
ch.CHAN('state',in); |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function ch = set.coupling(ch,in) |
|
|
function ch = set.coupling(ch,in) |
|
|
ch.scope.write(ch.CHANsend('coup',in)); |
|
|
|
|
|
|
|
|
ch.CHAN('coup',in); |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function ch = set.bandwidth(ch,in) |
|
|
function ch = set.bandwidth(ch,in) |
|
|
ch.scope.write(ch.CHANsend('band',in)); |
|
|
|
|
|
|
|
|
ch.CHAN('band',in); |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function ch = set.offset(ch,in) |
|
|
function ch = set.offset(ch,in) |
|
|
ch.scope.write(ch.CHANsend('offs',in)); |
|
|
|
|
|
|
|
|
ch.CHAN('offs',in); |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function ch = set.scale(ch,in) |
|
|
function ch = set.scale(ch,in) |
|
|
ch.scope.write(ch.CHANsend('scal',in)); |
|
|
|
|
|
|
|
|
ch.CHAN('scal',in); |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function ch = set.label(ch,in) |
|
|
function ch = set.label(ch,in) |
|
|
ch.scope.write(ch.CHANsend('lab',in)); |
|
|
|
|
|
|
|
|
ch.CHAN('lab',in); |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function out = frequency(ch) |
|
|
function out = frequency(ch) |
|
|
@@ -98,19 +98,44 @@ classdef Channel |
|
|
out = str2double(ch.MEAS('phas')); |
|
|
out = str2double(ch.MEAS('phas')); |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function data = waveform(ch) |
|
|
|
|
|
ch.scope.clear; |
|
|
|
|
|
ch.CHAN('TYPE HRES'); |
|
|
|
|
|
ch.scope.write('FORM REAL'); |
|
|
|
|
|
ch.scope.write('FORM:BORD MSBF'); |
|
|
|
|
|
ch.CHAN('DATA:POIN DEF'); |
|
|
|
|
|
ch.scope.write('SING'); |
|
|
|
|
|
header = str2num(ch.CHAN('DATA:HEAD?')); |
|
|
|
|
|
ch.scope.opc; |
|
|
|
|
|
ch.scope.write_unsafe('CHAN1:DATA?'); |
|
|
|
|
|
prefixstring = fscanf(ch.scope.tcp,'%c',2); |
|
|
|
|
|
prefixlength = str2double(prefixstring(2)); |
|
|
|
|
|
datalength = fscanf(ch.scope.tcp,'%c',prefixlength); |
|
|
|
|
|
data = fread(ch.scope.tcp,header(3),'float'); |
|
|
|
|
|
flushinput(ch.scope.tcp); |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
methods (Hidden, Access = private) |
|
|
methods (Hidden, Access = private) |
|
|
function c = CHAN(ch,string) |
|
|
function c = CHAN(ch,string) |
|
|
c = ['CHAN',num2str(ch.channelnumber),':',string]; |
|
|
|
|
|
|
|
|
if nargin == 2 |
|
|
|
|
|
if strcmp(string(end),'?') |
|
|
|
|
|
c = ch.scope.query(['CHAN',num2str(ch.channelnumber),':',string]); |
|
|
|
|
|
else |
|
|
|
|
|
c = ch.scope.write(['CHAN',num2str(ch.channelnumber),':',string]); |
|
|
|
|
|
end |
|
|
|
|
|
else |
|
|
|
|
|
c = ['CHAN',num2str(ch.channelnumber),':',string,' ',in]; |
|
|
|
|
|
end |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function c = MEAS(ch,string) |
|
|
function c = MEAS(ch,string) |
|
|
c = ch.scope.query(['MEAS',num2str(ch.channelnumber),':RES:ACT?',string]); |
|
|
c = ch.scope.query(['MEAS',num2str(ch.channelnumber),':RES:ACT?',string]); |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function c = CHANsend(ch,string,in) |
|
|
|
|
|
c = ['CHAN',num2str(ch.channelnumber),':',string,' ',in]; |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
% function c = CHANsend(ch,string,in) |
|
|
|
|
|
% c = ['CHAN',num2str(ch.channelnumber),':',string,' ',in]; |
|
|
|
|
|
% end |
|
|
end |
|
|
end |
|
|
end |
|
|
end |