User`s guide
6 Acquiring Image Data
6-34
Waiting for an Acquisition to Finish
In this section...
“Using the wait Function” on page 6-34
“Blocking the Command Line Until an Acquisition Completes” on page 6-35
Using the wait Function
The start function and the trigger function are asynchronous functions. That is,
they start the acquisition of frames and return control to the MATLAB command line
immediately.
In some scenarios, you might want your application to wait until the acquisition
completes before proceeding with other processing. To do this, call the wait function
immediately after the start or trigger function returns. The wait function blocks
the MATLAB command line until an acquisition completes or a timeout value expires,
whichever comes first.
By default, wait blocks the command line until a video input object stops running. You
can optionally specify that wait block the command line until the object stops logging.
For acquisitions using an immediate trigger, video input objects always stop running and
stop logging at the same time. However, with a manual trigger configured for multiple
executions (TriggerRepeat > 0), you can use wait immediately after each call to the
trigger function to block the command line while logging is in progress, even though
the object remains in running state throughout the entire acquisition.
The following figure illustrates the flow of control at the MATLAB command line for a
single execution of an immediate trigger and a manual trigger, with and without the
wait function. A hardware trigger is similar to the manual trigger diagram, except that
the acquisition is triggered by an external signal to the camera or frame grabber board,
not by the trigger function. For an example, see “Blocking the Command Line Until an
Acquisition Completes” on page 6-35.