startat

Method of timer objects: starts the timer at a given date and time.

Category: Programming > Programming Utilities

Syntax

startat(t, time)

Starts t so that it first fires at time.

Description

startat replaces the relative StartDelay by an absolute moment, which suits tasks planned for a time of day. If the moment is already past, the timer is not started.

Input arguments

t
A timer object.
time
The moment of the first call, as a date number from datenum or now, or a date string.

Example

Starting a moment from now

t = timer('TimerFcn', @(~,~) disp('fired on time'));
startat(t, now + 0.02 / 86400)
wait(t)
delete(t)
Output
fired on time

See also

timer start stop now datenum