User`s guide

7 Using Events and Callbacks
The toolbox adds event structures to the EventLog arrayintheorderinwhich
the events occur. The first event structure reflects the first event recorded,
the second event structure reflects the second event recorded, and so on.
Note Only start, stop, e rror, and trigger events are recorded in the EventLog
property. Frames-acquired events and timer events are not included in the
EventLog. Event structures for these events (and all the other events) are
available to callback functions. For m ore information, see “Creating and
Executing Callback Functions” on page 7-12.
To illustrate the event log, this example creates a video input object, runs it,
and then examines the object’s
EventLog property:
1 Create an im age acquisition object Th i s example creates a video
input o bj ect for a M atrox ima ge acquisition device. To run th is 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.
vid = videoinput('mat rox',1);
2 Start the image acquisition object Start the im age acquisition object.
By default, the object executes a n immediate trigger, acquires 10 frames of
data, and then stops.
start(vid)
3 View the event log Access the EventL og property of the video input
object. The execution of the video input object generated three events:
start, trigger, and stop. Thus the value of the
EventLog property is a 1x3
array of event structures.
events = vid.EventLog
events =
1x3 struct array with fiel ds:
Type
Data
7-10