Image Acquisition Toolbox Previous page   Next Page

Waiting for an Acquisition to Finish

When you trigger an acquisition, control returns to the command line before data logging is complete. In some cases, you might want to delay further processing until the number of frames you requested has been logged. To block the command line until logging is finished, use the wait function.

The following example illustrates the wait function.

  1. Create an image acquisition object -- This example creates a video input object for a Matrox image acquisition device. To run this example on your system, use the imaqhwinfo function to get the object constructor for your image acquisition device and substitute that syntax for the following code.
  2. Configure properties -- To illustrate how wait blocks until all the specified frames become available, configure an acquisition large enough to produce a noticeable duration.
  3. Start the image acquisition object -- Call the start function to start the image acquisition object.

  1. The object executes an immediate trigger and begins acquiring frames of data. The start function returns control to the command line immediately but the object continues logging the data to the memory buffer.

  1. Block the command line until the acquisition finishes -- After the start function returns, call the wait function.

  1. The wait function returns control to the command line when the value of the video input object's Running property changes from 'on' to 'off'.

  1. Clean up -- Always remove image acquisition objects from memory, and the variables that reference them, when you no longer need them.


Previous page  Specifying Multiple Triggers Managing Memory Usage Next page

Learn more about the latest releases of MathWorks products:

 © 1994-2010 The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS