8888 obj.axis_C.YLabel.String= [obj .taskB .DAQdevice , ' Voltage (V)' ];
8989
9090 % Set properties of axes together
91- set([obj .axis_A ,obj .axis_B ,obj .axis_C ], ' Box' , ' On' , ' XGrid' , ' On' , ' YGrid' , ' On' , ' YLim' , [obj .taskA .minVoltage ,obj .taskA .maxVoltage ], ' XLim' ,[0 ,obj .minPointsToPlot ])
92-
91+ set([obj .axis_A ,obj .axis_B ,obj .axis_C ], ' Box' , ' On' , ' XGrid' , ' On' , ' YGrid' , ' On' , ...
92+ ' YLim' , [obj .taskA .minVoltage ,obj .taskA .maxVoltage ], ' XLim' ,[0 ,obj .minPointsToPlot ])
93+
94+ set(obj .axis_C , ' XLim' , [obj .taskA .minVoltage ,obj .taskA .maxVoltage ])
95+
9396 addlistener(obj .taskA ,' acquiredData' , ' PostSet' , @(src ,eventData ) obj .plotIt(src ,eventData ) );
9497
9598
@@ -106,12 +109,17 @@ function delete(obj)
106109 end % close destructor
107110
108111
109- function plotIt(obj ,src ,eventData )
112+ function plotIt(obj ,~ ,eventData )
110113
111114 AIdata= eventData .AffectedObject .acquiredData ; % Get the data
112115
113116 % lock to the first upward 0 V crossing
114- tmp= smooth(AIdata(: ,1 ));
117+ if exist(' smooth' ,' builtin' )
118+ tmp= smooth(AIdata(: ,1 ));
119+ else
120+ % Hope smoothing isn't necessary if the tlbx is missing
121+ tmp= AIdata(: ,1 );
122+ end
115123 tmp= round(tmp ,2 );
116124 f= find(tmp(1 : end - 1 ,1 )==0 & diff(tmp(: ,1 ))>0 );
117125 if isempty(f )
0 commit comments