start

Method of timer objects: starts the timer.

Category: Programming > Programming Utilities

Syntax

start(t)

Starts the timer t; it waits StartDelay seconds, then begins calling TimerFcn.

Description

start acts on timer objects created with timer. After it returns, the timer's Running property is 'on' and the callbacks fire in the background while the script continues. Use wait to block until the timer finishes, or stop to cancel it. Starting a timer that is already running has no effect.

Input arguments

t
A timer object, or an array of timers.

Example

Starting a one-shot timer

t = timer('StartDelay', 0.01, 'TimerFcn', @(~,~) disp('fired'));
start(t)
wait(t)
disp(t.Running)
delete(t)
Output
fired
off

See also

timer stop wait startat