From 15dde07b892fcd5762e579010b060ebf9a2196eb Mon Sep 17 00:00:00 2001 From: Wouter Horlings Date: Wed, 22 Nov 2017 22:32:49 +0100 Subject: [PATCH] Added a channel class for Oscilloscope --- OOequipment/Channel.m | 22 ++++++++++++++++++++++ OOequipment/Oscilloscope.m | 13 +++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 OOequipment/Channel.m diff --git a/OOequipment/Channel.m b/OOequipment/Channel.m new file mode 100644 index 0000000..7112fdf --- /dev/null +++ b/OOequipment/Channel.m @@ -0,0 +1,22 @@ +classdef Channel + %CHANNEL Summary of this class goes here + % Detailed explanation goes here + + properties + Property1 + end + + methods + function obj = Channel(inputArg1,inputArg2) + %CHANNEL Construct an instance of this class + % Detailed explanation goes here + obj.Property1 = inputArg1 + inputArg2; + end + + function outputArg = method1(obj,inputArg) + %METHOD1 Summary of this method goes here + % Detailed explanation goes here + outputArg = obj.Property1 + inputArg; + end + end +end \ No newline at end of file diff --git a/OOequipment/Oscilloscope.m b/OOequipment/Oscilloscope.m index ae3055f..3830330 100644 --- a/OOequipment/Oscilloscope.m +++ b/OOequipment/Oscilloscope.m @@ -3,15 +3,16 @@ classdef Oscilloscope < Equipment % Detailed explanation goes here properties - ch1 - ch2 end methods - function obj = Oscilloscope(inputArg1,inputArg2) + function obj = Oscilloscope(ipAddress,port,nchannels) %OSCILLOSCOPE Construct an instance of this class % Detailed explanation goes here - obj.Property1 = inputArg1 + inputArg2; + obj@Equipment(ipAddress,port,-1); + for i = 1:nchannels + obj.(['ch',num2str(i)]) = Channel(inputArg1,inputArg2); + end end function outputArg = method1(obj,inputArg) @@ -22,3 +23,7 @@ classdef Oscilloscope < Equipment end end + + + +