classdef Channel %CHANNEL Summary of this class goes here % Detailed explanation goes here properties (Hidden, Access = private) scope channelnumber end properties (Dependent) state coupling bandwidth scale offset probe label end methods function ch = Channel(scope,channelnumber) ch.channelnumber = channelnumber; ch.scope = scope; end function s = get.state(ch) s = ch.scope.query(ch.CHAN('state?')); end function out = get.coupling(ch) out = ch.scope.query(ch.CHAN('coup?')); end function out = get.bandwidth(ch) out = ch.scope.query(ch.CHAN('band?')); end function out = get.offset(ch) out = ch.scope.query(ch.CHAN('offs?')); end function out = get.scale(ch) out = ch.scope.query(ch.CHAN('scal?')); end function out = get.label(ch) out = ch.scope.query(ch.CHAN('lab?')); end function ch = set.state(ch,in) ch.scope.write(ch.CHANsend('state',in)); end function ch = set.coupling(ch,in) ch.scope.write(ch.CHANsend('coup',in)); end function ch = set.bandwidth(ch,in) ch.scope.write(ch.CHANsend('band',in)); end function ch = set.offset(ch,in) ch.scope.write(ch.CHANsend('offs',in)); end function ch = set.scale(ch,in) ch.scope.write(ch.CHANsend('scal',in)); end function ch = set.label(ch,in) ch.scope.write(ch.CHANsend('lab',in)); end function out = frequency(ch) out = str2double(ch.MEAS('freq')); end function out = peak2peak(ch) out = str2double(ch.MEAS('peak')); end function out = period(ch) out = str2double(ch.MEAS('per')); end function out = amplitude(ch) out = str2double(ch.MEAS('ampl')); end function out = mean(ch) out = str2double(ch.MEAS('mean')); end function out = rms(ch) out = str2double(ch.MEAS('rms')); end function out = phase(ch) out = str2double(ch.MEAS('phas')); end end methods (Hidden, Access = private) function c = CHAN(ch,string) c = ['CHAN',num2str(ch.channelnumber),':',string]; end function c = MEAS(ch,string) c = ch.scope.query(['MEAS',num2str(ch.channelnumber),':RES:ACT?',string]); end function c = CHANsend(ch,string,in) c = ['CHAN',num2str(ch.channelnumber),':',string,' ',in]; end end end