"If" statements for NI daq functions!? Help?
Show older comments
Hi all,
I am trying to get matlab to output some signals via my NI card, but I would like to turn on and off the signal via a timer using "if" statements.
For example,
experimentStartTime = tic;
niSession = daq.createSession('ni');
niSession.addAnalogOutputChannel('dev1','ao0','voltage');
niSession.queueOutputData([stimulus']);
stimStartTime = toc;
if toc-stimStartTime < 5
niSession.startBackground();
elseif toc-stimStartTime > 5
niSession.stop()
end
However, MATLAB doesnt seem to run through the if loops and stop the analog Output. Any help would be great. Thanks!
Accepted Answer
More Answers (0)
Categories
Find more on Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!