Skip to content

Commit 6818d8d

Browse files
committed
Do not attempt to start task if configuration failed
1 parent 0ee8d88 commit 6818d8d

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

code/DAQmx_Scanners/basicScanner.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,11 @@
144144
% call and by the destructor
145145
obj.connectToDAQandSetUpChannels
146146

147-
% Start the acquisition
148-
obj.start
149-
fprintf('Close figure to quit acquisition\n')
147+
if isvalid(obj)
148+
% Start the acquisition
149+
obj.start
150+
fprintf('Close figure to quit acquisition\n')
151+
end
150152
end % close constructor
151153

152154

code/DAQmx_Scanners/minimalScanner.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,11 @@
122122
% call and by the destructor
123123
obj.connectToDAQandSetUpChannels
124124

125-
% Start the acquisition
126-
obj.start
127-
fprintf('Close figure to quit acquisition\n')
125+
if isvalid(obj)
126+
% Start the acquisition
127+
obj.start
128+
fprintf('Close figure to quit acquisition\n')
129+
end
128130
end % close constructor
129131

130132

code/DAQmx_Scanners/polishedScanner.m

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,13 @@
167167
obj.connectToDAQandSetUpChannels
168168

169169
% Start the acquisition
170-
%Report frame rate to screen
171-
fprintf('Scanning with a frame size of %d by %d at %0.2f frames per second\n', ...
172-
obj.imSize, obj.imSize, obj.FPS);
173-
obj.start
174-
fprintf('Close figure to quit acquisition\n')
170+
if isvalid(obj)
171+
%Report frame rate to screen
172+
fprintf('Scanning with a frame size of %d by %d at %0.2f frames per second\n', ...
173+
obj.imSize, obj.imSize, obj.FPS);
174+
obj.start
175+
fprintf('Close figure to quit acquisition\n')
176+
end
175177
end % close constructor
176178

177179

0 commit comments

Comments
 (0)