Programming and Data Types    

Starting and Stopping Timers

After you create a timer object, you can start the timer by calling either the start or startat function.

The start function starts the timer immediately, changing the value of the timer object's Running property from 'off' to 'on':

The start function returns control to the MATLAB command line immediately. You can also choose to wait until the timer callback function (TimerFcn) executes before returning control to the command line. See Blocking the MATLAB Command Line for more information.

The startat function starts the timer immediately and sets the value of the StartDelay property to the time you specify:

Blocking the MATLAB Command Line

By default, when you start a timer, the start or startat function returns control to the command line immediately. If your application must wait until the function controlled by the timer executes, use the wait function right after calling the start function:

Stopping Timers

The timer stops running if one of the following conditions apply:

When a timer stops, the value of the Running property of the timer object is 'off'.


  Timer Object Properties Timer Object Execution Modes