User`s guide
Callback Sequencing and Interruption
h_plot = surf(h_axes2,peaks_data) ;
end
ViewtheCompleteGUICodeFile.If you are reading this in the MATLAB
Help browser, click here to display a complete lis ting of the code used in this
example in the MATLAB Editor.
Note This link executes MATLAB commands and is designed to work within
the M ATLA B Help browser. If you are reading this online or in a PDF, go to
the corresponding section in the MATLAB Help Browser to us e the links.
Control Program Execution Using Timer Objects
If you create a GUI that performs regularly scheduled tasks, such as acquiring
data, updating a display, polling devices or services, or autosaving results,
you can manage the activity with timers. Timers are MATLAB objects that
time execution of functions and programs. Timers have properties that you
cancustomizeforyourapplication. Forexample,youcanmakethemexecute
once or repeatedly, w ait before running, and handle delays in execution. The
following callbacks are among these properties.
Callback
Property
Description
Examples of Use
StartFcn
Function the tim er calls when
it starts
Open an input file or output
file, or initialize variables.
TimerFcn
Timer callback function that
triggers actions that the timer
controls
Acquire new data or flush old
data, or update a display.
StopFcn
Function the tim er calls when
it stops
Close input or output files, or
compute statistics for session.
ErrorFcn
Function that the timer
executes when an error occurs
(this function executes before
the
StopFcn.).
Called when a timeout occurs.
You can specify conditions
under which this can happen.
YoucanincludeanyofthesecallbacksinyourGUIcodefile.Yourcodealso
needs to create and configure the timer object when your GUI opens, and
14-11