MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

Timer Callback Functions


In this section...
“Associating Commands with Timer Object Events” on page 27-5
“Creating Callback Functions” on page 27-6
“Specifying the Value of Callback Function Properties” on page 27-8

NoteCallback function execution might be delayed if the callback involves a CPU-
intensive task such as updating a figure.

Associating Commands with Timer Object Events


The timer object supports properties that let you specify the MATLAB commands that
execute when a timer fires, and for other timer object events, such as starting, stopping,
or when an error occurs. These are called callbacks. To associate MATLAB commands
with a timer object event, set the value of the associated timer object callback property.

The following diagram shows when the events occur during execution of a timer object
and give the names of the timer object properties associated with each event. For
example, to associate MATLAB commands with a start event, assign a value to the
StartFcn callback property. Error callbacks can occur at any time.

Timer Callback Functions
Free download pdf