DAQ Toolbox: Continuous acquisition and generation locks Matlab up

2 views (last 30 days)
I'm new to the session-based data acquisition toolbox approach, but not new to data acquisition in general. Whenever I try to do a simultaneous, continuous acquisition and generation, Matlab locks up (i.e., I can't abort execution and have to shut down Matlab at the OS level). No errors or warnings. I'm using an NI PCI-6110 card in a Windows 7 machine with Matlab 2014a. Am I missing something? I couldn't find any relevant examples. The following code will reproduce the issue on my machine:
% Set up the session
s = daq.createSession('ni');
addAnalogInputChannel(s,'Dev3', 'ai0', 'Voltage');
addAnalogOutputChannel(s,'Dev3', 'ao0', 'Voltage');
s.Rate=2000;
sig=zeros(2500,1);
queueOutputData(s,sig)
% Set up the callbacks
storeData=@(src,event) stop(src);
putData=@(src,event) queueOutputData(src,sig);
addlistener(s,'DataRequired',putData);
addlistener(s,'DataAvailable',storeData);
s.NotifyWhenDataAvailableExceeds=500;
s.NotifyWhenScansQueuedBelow=500;
s.IsContinuous=true;
% Start the session
disp('Starting');
startBackground(s);
disp('Waiting');
s.wait(5);
It gets gummed up at s.wait. Technically, it should stop the first time it tries to retrieve data, but it never gets that far.
Thanks, Eric

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!