Programming |
Stopping Timer Objects
Once started, the timer object stops running if one of the following conditions apply:
TimerFcn
) has been executed the number of times specified in the TasksToExecute
property.
TimerFcn
).
You can also stop a timer object by using the stop
function, specifying the timer object as the only argument. The following example illustrates stopping a timer object:
stop
command and check the state again. When a timer stops, the value of the Running
property of the timer object is set to 'off'
.
Note The timer object can execute a callback function that you specify when it starts or stops. See Creating and Executing Callback Functions. |
Blocking the MATLAB Command Line
By default, when you use the start
or startat
function to start a timer object, the function returns control to the command line immediately. For some applications, you might prefer to block the command line until the timer fires. To do this, call the wait
function right after calling the start
or startat
function.
start
function returns, call the wait
function immediately. The wait
function blocks the command line until the timer object fires.
Starting a Timer at a Specified Time | Creating and Executing Callback Functions |
© 1994-2005 The MathWorks, Inc.