User`s guide

14 Manage Ca llback Executio n
delete the timer before your GUI closes. To start a timer, call its st art
method. The tim er executes its StartF cn, begins counting, and executes its
first
TimerFcn callback when the period specified by the S tartDelay property
expires. To halt a timer, call its
stop method.
Caution Timers are independent objects that operate asynchronously, as
do GUIs. A timer callback can change or even delete data used by your GUI
code or code it calls. It can also fail t o execute due to timing out. If such
possibilities exist fo r your application, y ou r code must g uard against them.
For example, it can test whether a variable continues to exist, or place code
that can fail w ithin try-catch blocks
For an example of a GUI that uses a tim er, se e “Time Data Updates from a
GUI (GUIDE)” on page 10-105. For more information about setting up timers
and controlling their run-time characteristics, see “Using a MATLAB Timer
Object” and the
timer reference page.
14-12