Programming |
Setting the Value of Timer Object Properties
To set the value of a timer object property, use the set
function or subscripted assignment (dot notation). You can also set timer object properties when you create the timer object. For more information, see Creating Timer Objects.
The following example uses both methods to assign values to timer object properties. The example creates a timer that, once started, displays a message every second until you stop it with the stop
command.
set
function.
TimerFcn
property using dot notation.
Viewing a List of All Settable Properties
To view a list of all timer object properties that can have values assigned to them (in contrast to the read-only properties), use the set
function, specifying the timer object as the only argument.
The display includes the values you can use to set the property if, like the BusyMode
property, the property accepts an enumerated list of values.
t = timer; set(t) BusyMode: [ {drop} | queue | error ] ErrorFcn: string -or- function handle -or- cell array ExecutionMode: [{singleShot} | fixedSpacing | fixedDelay | fixedRate] Name ObjectVisibility: [ {on} | off ] Period StartDelay StartFcn: string -or- function handle -or- cell array StopFcn: string -or- function handle -or- cell array Tag TasksToExecute TimerFcn: string -or- function handle -or- cell array UserData
Retrieving the Value of Timer Object Properties | Starting and Stopping Timers |
© 1994-2005 The MathWorks, Inc.