Data Acquisition Toolbox | ![]() ![]() |
Wait for the device object to stop running
Syntax
Arguments
obj |
A device object or an array of device objects. |
waittime |
The maximum time to wait for obj to stop running. |
Description
blocks the MATLAB command line, and waits for waittilstop(obj,waittime)
obj
to stop running. You specify the maximum waiting time, in seconds, with waittime
. waittime
overrides the value specified for the Timeout
property. If obj
is an array of device objects, then waittilstop
might wait up to the specified time for each device object in the array.
waittilstop
is particularly useful if you want to guarantee that the specified data is acquired before another task is performed.
Remarks
If obj
is not running when waittilstop
is issued, or if an error occurs while obj
is running, then waittilstop
immediately relinquishes control of the command line.
When obj
stops running, its Running
property is automatically set to Off
. obj
can stop running under one of the these conditions:
stop
function is issued.
Timeout
property value is reached (waittime
supersedes this value).
It is not guaranteed that the StopFcn
property
is called before waittilstop
returns. The stop event is recorded by the EventLog
property.
Example
Create the analog input object ai
for a National Instruments board, add eight channels to it, and configure a 25 second acquisition.
ai = analoginput('nidaq',1); ch = addchannel(ai,0:7); ai.SampleRate = 2000; ai.TriggerRepeat = 4; ai.SamplesPerTrigger = 10000;
You can use waittilstop
to block the MATLAB command line until all the requested data is acquired. Because the expected acquisition time is 25 seconds, the waittime
argument is 26
. If the acquisition does not complete within this time, then a timeout occurs.
Properties
EventLog
, Running
, StopFcn
, Timeout
![]() | trigger | Base Property Reference | ![]() |