23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Timer Object Execution Modes<br />

Timer Object Execution Modes<br />

The timer object supports several execution modes that determine how it<br />

schedules the timer callback function (TimerFcn) for execution. You specify<br />

the execution mode by setting the value of the ExecutionMode property. This<br />

section describes<br />

• “Executing a Timer Callback Function Once” on page 10-19<br />

• “Executing a Timer Callback Function Multiple Times” on page 10-20<br />

• “Handling Callback Function Queuing Conflicts” on page 10-21<br />

Executing a Timer Callback Function Once<br />

To execute a timer callback function once, set the ExecutionMode property to<br />

'singleShot'. Thisisthedefaultexecutionmode.<br />

In this mode, the timer object starts the timer and, after the time period<br />

specified in the StartDelay property elapses, adds the timer callback function<br />

(TimerFcn) to the <strong>MATLAB</strong> execution queue. When the timer callback<br />

function finishes, the timer stops.<br />

The following figure graphically illustrates the parts of timer callback<br />

execution for a singleShot execution mode. The shaded area in the figure,<br />

labelled queue lag, represents the indeterminate amount of time between<br />

when the timer adds a timer callback function to the <strong>MATLAB</strong> execution<br />

queue and when the function starts executing. The duration of this lag is<br />

dependent on what other processing <strong>MATLAB</strong> happens to be doing at the time.<br />

Timer Callback Execution (singleShot Execution Mode)<br />

10-19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!