Data Acquisition Toolbox    
waittilstop

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

waittilstop(obj,waittime) blocks the MATLAB command line, and waits for 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:

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.

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.

See Also

Properties

EventLog, Running, StopFcn, Timeout


  trigger Base Property Reference