Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan 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.

wait(s,timeout) blocks MATLAB until the operation completes or the specified timeout occurs.

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.

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, specified as a number. This value is the maximum time in seconds before the wait throws an error.

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 and 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)

See Also

Functions

Was this topic helpful?