Main Content

wait

Wait until image acquisition object stops running or logging

Description

wait(videoinput) blocks the MATLAB® command line until the videoinput object stops running (Running = "off"). Use the wait function to guarantee data acquisition before performing another task.

wait(videoinput,waitTime) blocks the MATLAB command line until the videoinput object or array of objects videoinput stops running or until waittime seconds expire, whichever comes first. By default, the function sets the waittime value to the value of the Timeout property of the object.

example

wait(videoinput,waitTime,state) blocks the MATLAB command line until the video input object or array of objects videoinput stops running or logging, or until waittime seconds have expired, whichever comes first.

Note

The stop event callback function (StopFcn) of the object might not be called before this function executes.

An image acquisition object stops running under one of these conditions:

  • Issuance of the stop function.

  • Acquisition of the requested number of frames. Acquisition is complete when

    FramesAcquired = FramesPerTrigger * (TriggerRepeat + 1)

    FramesAcquired, FramesPerTrigger, and TriggerRepeat are properties of the videoinput object.

  • Occurrence of a run-time error.

  • Expiration of the Timeout value of the object.

Examples

collapse all

Create a video input object.

vid = videoinput("winvideo");

Specify the acquisition duration. Set the FramesPerTrigger property to 100.

vid.FramesPerTrigger = 300;

Start the video acquisition. Because the object uses an immediate trigger (the default), acquisition begins when the object starts.

start(vid);

Wait for the acquisition to complete. Use the wait function to block the MATLAB command line until acquisition finishes

wait(vid,60);

Input Arguments

collapse all

Video input, specified as a single videoinput object or an array of videoinput objects.

When videoinput is an array of objects, the wait function waits until all objects in the array stop running. If videoinput is not running or is an invalid object, wait returns immediately.

Waiting time, specified as a positive scalar. Units are in seconds. By default, the function sets the waittime value to the value of the Timeout property of the videoinput object.

State of the video input, specified as one of these options.

  • "running" — Blocks until the value of the Running property of the object is "off".

  • "logging" — Blocks until the value of the Logging property of the object is "off".

Note

To get a list of options you can use on a function, press the Tab key after entering a function at the MATLAB command line. The list expands and you can scroll to choose a property or value.

Version History

Introduced before R2006a

See Also

| | |