MATLAB Function Reference Previous page   Next Page
startat

Start timer(s) running at the specified time

Syntax

Description

startat(obj,time) starts the timer running, represented by the timer object obj, at the time specified by the serial date number time. If obj is an array of timer objects, startat starts all the timers running at the specified time. Use the timer function to create the timer object.

startat sets the Running property of the timer object, obj, to 'on', initiates TimerFcn callbacks, and executes the StartFcn callback.

The serial date number, time, indicates the number of days that have elapsed since 1-Jan-0000 (starting at 1). See datenum for additional information about serial date numbers.

startat(obj,S) starts the timer running at the time specified by the date string S. The date string must use date format 0, 1, 2, 6, 13, 14, 15, 16, or 23, as defined by the datestr function. Date strings with two-character years are interpreted to be within the 100 years centered on the current year.

startat(obj,S,pivotyear) uses the specified pivot year as the starting year of the 100-year range in which a two-character year resides. The default pivot year is the current year minus 50 years.

startat(obj,Y,M,D)
startat(obj,[Y,M,D])
start the timer at the year (Y), month (M), and day (D) specified. Y, M, and D must be arrays of the same size (or they can be a scalar).

startat(obj,Y,M,D,H,MI,S)
startat(obj,[Y,M,D,H,MI,S])
start the timer at the year (Y), month (M), day (D), hour (H), minute (MI), and second (S) specified. Y, M, D, H, MI, and S must be arrays of the same size (or they can be a scalar). Values outside the normal range of each array are automatically carried to the next unit (for example, month values greater than 12 are carried to years). Month values less than 1 are set to be 1; all other units can wrap and have valid negative values.

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

Examples

This example uses a timer object to execute a function at a specified time.

This example uses a timer to display a message when an hour has elapsed.

See Also

datenum, datestr, now, timer, start, stop


Previous page  start startup Next page

© 1994-2005 The MathWorks, Inc.