Problem using surf() command in data acquisition wait(session, timeOut) !

1 view (last 30 days)
Hi, I'm new to data acquisition toolbox. Currently I'm using the daq toolbox to generate and capture the data to and from NI 6211.
I acquire the data in background and process the data using listeners. The problem is:
When I plot the data using "plot" command, it's ok. But when using "surf" command, the timeOut of wait(session, timeOut) is not working correctly any more. It does not matter how long I set the value "timeOut" to be (e.g 20 seconds), Matlab always stop running after (approx. 3seconds).
here is my code:
Fs = 125e3;
sOut = daq.createSession('ni');
ao_0 = addAnalogOutputChannel(sOut, 'Dev1', 0, 'Voltage');
ai_4 = addAnalogInputChannel(sOut, 'Dev1', 4, 'Voltage'); ai_5 = addAnalogInputChannel(sOut, 'Dev1', 5, 'Voltage');
sOut.Rate = Fs; sOut.IsNotifyWhenScansQueuedBelowAuto = false; sOut.NotifyWhenScansQueuedBelow = Fs; sOut.IsContinuous = true;
queueOutputData(sOut, outSignal);
lhOut = addlistener(sOut,'DataRequired',@(src,event) src.queueOutputData(outSignal));
sOut.NotifyWhenDataAvailableExceeds = numSample;
lhIn = addlistener(sOut,'DataAvailable',@(src,event)myFunction);
sOut.startBackground();
wait(sOut,runningTime); delete(lhOut); delete(lhIn); end
function myFunction() plot(event.Data); %% this is ok surt(event.Data); %% this has a problem
end
.
.
. Can someone help me please. Thanks

Answers (0)

Categories

Find more on Data Acquisition Toolbox Supported Hardware 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!