MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
Timer Object Events and Related Callback Function

Creating Callback Functions


When the time period specified by a timer object elapses, the timer object executes one or
more MATLAB functions of your choosing. You can specify the functions directly as the
value of the callback property. You can also put the commands in a function file and
specify the function as the value of the callback property.

Specifying Callback Functions Directly

This example creates a timer object that displays a greeting after 5 seconds. The example
specifies the value of the TimerFcn callback property directly, putting the commands in a
character vector.

27 Program Scheduling

Free download pdf