How to a log analog input data from during background continuous acquisition ?

3 views (last 30 days)
I am trying to save data recorded during a background acquisition. In theory, following the online help, one could add a listener to the session and direct its src/evt to a file. However, perhaps because the session start is in a loop, I can´t get it to work with two listeners (I am not even sure if 2 are actually allowed), as the same source ('DataAvailable') is already called by another function (Scope). Any idea on how I could fix it ?
%% Recording cycle for i=1:cycles s = daq.createSession('ni'); a1 = addAnalogInputChannel(s,'Dev2','ai0','Voltage'); a2 = addAnalogInputChannel(s,'Dev2','ai1','Voltage'); lh = addlistener(s,'DataAvailable',@scope); s.IsContinuous = true; s.startBackground; pause(duration); s.stop s = daq.createSession('ni'); a1 = addAnalogInputChannel(s,'Dev2','ai0','Voltage'); a2 = addAnalogInputChannel(s,'Dev2','ai1','Voltage'); o1 = addAnalogOutputChannel(s,'Dev2','ao0','Voltage'); queueOutputData(s,EOD); lh = addlistener(s,'DataAvailable',@scope); s.IsContinuous = true; s.startBackground; pause(playback_duration); s.stop; release(s); end

Answers (0)

Community Treasure Hunt

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

Start Hunting!