Events occur during an acquisition at a particular time when a condition is met. These events include:
All acquisitions consist of at least 3 events:
Starting the device
Triggering the device
Stopping the device.
Initiate a basic acquisition using a video input object.
% Access an image acquisition device. vidobj = videoinput('winvideo', 1); % Use a manual trigger to initiate data logging. triggerconfig(vidobj, 'manual'); % Start the acquisition. start(vidobj) % Trigger the object to start logging and allow the acquisition to run for % couple of seconds. trigger(vidobj) pause(2); % Stop the acquisition stop(vidobj)
To view event information for the acquisition, access the
EventLog property of the video input object. Events are recorded in chronological order.
% View the event log. events = vidobj.EventLog
events = 1x3 struct array with fields: Type Data
Each event provides information on the state of the object at the time the event occurred.
% Display first event. event1 = events(1)
event1 = Type: 'Start' Data: [1x1 struct]
data1 = events(1).Data
data1 = AbsTime: [2005 6 5 23 53 14.1680] FrameMemoryLimit: 341692416 FrameMemoryUsed: 0 FrameNumber: 0 RelativeFrame: 0 TriggerIndex: 0
% Display second event. event2 = events(2)
event2 = Type: 'Trigger' Data: [1x1 struct]
data2 = events(2).Data
data2 = AbsTime: [2005 6 5 23 53 14.7630] FrameMemoryLimit: 341692416 FrameMemoryUsed: 0 FrameNumber: 0 RelativeFrame: 0 TriggerIndex: 1
% Display third event. event3 = events(3)
event3 = Type: 'Stop' Data: [1x1 struct]
data3 = events(3).Data
data3 = AbsTime: [2005 6 5 23 53 16.9970] FrameMemoryLimit: 341692416 FrameMemoryUsed: 768000 FrameNumber: 5 RelativeFrame: 5 TriggerIndex: 1
% Once the video input object is no longer needed, delete % it and clear it from the workspace. delete(vidobj) clear vidobj