This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

wait

Block MATLAB until background operation completes

Syntax

wait(s)
wait(s,timeout)

Description

example

wait(s) blocks MATLAB® until the background operation completes. To abort the wait, press Ctrl+C.

Tips

You cannot call wait if you have set the session IsContinuous property to true. To terminate the operation in this case, use the stop function.

wait(s,timeout) blocks MATLAB until the operation completes or the specified timeout occurs. If the session operation does not complete before this timeout occurs, MATLAB is unblocked, an error is thrown, and the data acquisition session operation continues running.

Examples

collapse all

Create a session and add an analog output channel.

s = daq.createSession('ni');
addAnalogOutputChannel(s,'cDAQ1Mod2','ao0','Voltage');

Queue some output data.

queueOutputData(s,zeros(10000,1));

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)

Input Arguments

collapse all

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 acquisition operations.

Session timeout value in seconds, specified as a numeric value. This value is the maximum time in seconds to wait.

See Also

Functions

Introduced in R2010b