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.

10 Scheduling Program Execution with Timers<br />

Creating and Executing Callback Functions<br />

This section describes<br />

• “Associating Commands with Timer Object Events” on page 10-14<br />

• “Creating Callback Functions” on page 10-15<br />

• “Specifying the Value of Callback Function Properties” on page 10-17<br />

Note Callback function execution might be delayed if the callback involves<br />

a CPU-intensive task such as updating a figure.<br />

Associating Commands with Timer Object Events<br />

The timer object supports properties that let you specify the <strong>MATLAB</strong><br />

commands that execute when a timer fires, and for other timer object events,<br />

such as starting, stopping, or when an error occurs. These are called callbacks.<br />

To associate <strong>MATLAB</strong> commands with a timer object event, set the value of<br />

the associated timer object callback property.<br />

The following diagram shows when the events occur during execution of a<br />

timer object and give the names of the timer object properties associated<br />

with each event. For example, to associate <strong>MATLAB</strong> commands with a start<br />

event, assign a value to the StartFcn callback property. Error callbacks can<br />

occur at any time.<br />

10-14

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

Saved successfully!

Ooh no, something went wrong!