User`s guide

7 Using Events and Callbacks
function display_f rame (obj,event)
sample_frame = peekdat a(obj,1);
imagesc(sample_frame);
drawnow; % force an update of the figure window
abstime = event.Data.A bsTime;
t = fix(abstime);
sprintf('%s %d:%d: %d', 'timestamp', t(4),t(5),t(6))
To see how this function can be used as a callback, see “Example: Viewing a
Sample Frame” on page 7-16.
Specifying Callback Functions
You associa te a callback function wi t h a specific event by setting the value
of the event’s callback property. The video input object supports callback
properties for all types of events.
You can specify the callback function as the value of the property in any of
three ways:
Text string
Cell array
Function handle
The fol lowing sections pr ovide m ore informatio n about each of these options.
Note To access the object or event structure passed to the callback function,
you must specify the function as a cell array or as a function handle.
7-14