User`s guide

8 Using Events and Callbacks
8-12
Creating and Executing Callback Functions
In this section...
“Introduction” on page 8-12
“Creating Callback Functions” on page 8-12
“Specifying Callback Functions” on page 8-14
“Viewing a Sample Frame” on page 8-16
“Monitoring Memory Usage” on page 8-17
Introduction
The power of using event callbacks is the processing that you can perform in response to
events. You decide which events you want to associate callbacks with and the functions
these callbacks execute.
This section
Describes how to create a callback function
Describes how to specify the function as the value of a callback property
Provides two examples of using event callbacks:
Shows how to use callbacks to view a sample frame from the frames being acquired
Uses callback to implement a simple memory monitoring function
Note Callback function execution might be delayed if the callback involves a CPU-
intensive task such as updating a figure.
Creating Callback Functions
This section explains how to create callback functions for the TimerFcn,
FramesAcquiredFcn, StartFcn, StopFcn, TriggerFcn, and ErrorFcn callbacks.
Callback functions require at least two input arguments:
The image acquisition object
The event structure associated with the event