User`s guide

Bringing Image Data into the MATLAB Workspace
7-9
Verify that the object has not acquired any frames.
vid.FramesAcquired
ans =
0
5
Trigger the acquisition — Call the trigger function to trigger an acquisition.
trigger(vid)
The object begins logging frames to the memory buffer.
6
View the most recently acquired frames — While the acquisition is in progress,
call peekdata several times to view the latest frames in the memory buffer.
Depending on the number of frames you request, and the timing of these requests,
peekdata might return fewer than the number of frames you specify.
pdata = peekdata(vid,50);
To verify that peekdata returned the frames you requested, check the dimensions
of pdata. peekdata returns a four-dimensional array of frames, where the last
dimension indicates the number of frames returned.
whos
Name Size Bytes Class
pdata 4-D 1843200 uint8 array
vid 1x1 1060 videoinput object
size(pdata)
ans =
96 128 3 50
7
Clean up — Always remove image acquisition objects from memory, and the
variables that reference them, when you no longer need them.
delete(vid)
clear vid