(Not recommended) Block MATLAB until background operation completes
Create a session and add an analog output channel.
s = daq.createSession('ni'); addAnalogOutputChannel(s,'cDAQ1Mod2','ao0','Voltage');
Queue some output data.
Start the session, then issue a
wait. This blocks
MATLAB until all data is output.
startBackground(s); % Perform other MATLAB operations. wait(s)
Queue more data and wait for up to 15 seconds.
queueOutputData(s,zeros(10000,1)); startBackground(s); % Perform other MATLAB operations. wait(s,15)
s— Data acquisition session
Data acquisition session, specified as a session object. Create the
session object using
daq.createSession. Use the data
acquisition session for acquisition and generation operations. Create one
session per vendor and use that vendor session to perform all data
timeout— Session timeout value
Session timeout value in seconds, specified as a numeric value. This value is the maximum time in seconds to wait.
sessionobject interface is not recommended
Not recommended starting in R2020a
Use of this function with a
session object is not recommended. To
access a data acquisition device, use a
with its functions and properties instead.
For more information about using the recommended functionality, see Transition Your Code from Session to DataAcquisition Interface.