isvalid

Class: timer

Determine timer object validity

Description

example

validCheck = isvalid(t) determines timer object validity and returns a logical array, validCheck, that contains a 0 where the elements of t are invalid timer objects and a 1 where the elements of t are valid timer objects.

An invalid timer object is an object that is deleted from memory using delete and cannot be reused. Use the clear command to remove an invalid timer object from the workspace.

Input Arguments

t

Object or array of objects of class timer

Examples

expand all

Create a timer object. While this timer object is valid, it cannot start because a TimerFcn is not defined.

t = timer;
out = isvalid(t)
out =

     1

Delete the timer object, making it invalid.

delete(t)
out1 = isvalid(t)
out1 =

     0

Tips

  • To return timer objects existing in memory, use the timerfind and timerfindall methods. This practice is useful if the reference to the timer object is cleared from the workspace (using the clear function), but the object has not been deleted from memory.

Introduced before R2006a