Programming Previous page   Next Page

Timer Object Execution Modes

The timer object supports several execution modes that determine how it schedules the timer callback function (TimerFcn) for execution. You specify the execution mode by setting the value of the ExecutionMode property. This section describes

Executing a Timer Callback Function Once

To execute a timer callback function once, set the ExecutionMode property to 'singleShot'. This is the default execution mode.

In this mode, the timer object starts the timer and, after the time period specified in the StartDelay property elapses, adds the timer callback function (TimerFcn) to the MATLAB execution queue. When the timer callback function finishes, the timer stops.

The following figure graphically illustrates the parts of timer callback execution for a singleShot execution mode. The shaded area in the figure, labelled queue lag, represents the indeterminate amount of time between when the timer adds a timer callback function to the MATLAB execution queue and when the function starts executing. The duration of this lag is dependent on what other processing MATLAB happens to be doing at the time.

Timer Callback Execution (singleShot Execution Mode)


Previous page  Specifying the Value of Callback Function Properties Executing a Timer Callback Function Multiple Times Next page

© 1994-2005 The MathWorks, Inc.