User`s guide

Managing Memory Usage
Freeing Memory
At times, while acquiring image data, you m ight want to delete some or all
of the frames that are stored in memory. U sing the
flushdata function, you
can delete all the frames currently stored in memory or only those frames
associated with the execution of a trigger.
The following example illustrates how to use
flushdata to delete all the
frames in memory or one trigg er’s w orth of frames.
1 Create an im age acquisition object Th i s example creates a video
inputobjectforaWindowsimageacquisition device. To run this example
on yo ur system, use the
imaqhwinfo function to get the object constructor
for your image acquisition device and substitute that syntax for the
following code.
vid = videoinput('win video',1);
2 Configure properties For this example, configure an acquisition of five
frames per trigger and, to show the effect of
flushdata, configure mul tiple
triggers using the
TriggerRepeat property.
vid.FramesPerTrigger = 5
vid.TriggerRepeat = 2;
3 Start the image acquisition object —Callthestart function to start
the image acquisition object.
start(vid)
The object executes an immediate trigger, acquires five f rames of data, and
repeats t h is trigger two more times. After logging th e specified number
of frames, the object stops running.
5-37