timerfindall

Finds all timer objects, including those hidden from timerfind.

Category: Programming > Programming Utilities

Syntax

out = timerfindall

Returns every timer object that exists.

out = timerfindall(Name, Value, ...)

Returns the timers whose properties match the given values.

Description

Timers can be created with the ObjectVisibility property set to 'off', which hides them from timerfind. timerfindall ignores that setting, so it is the call to use when cleaning up every timer, for example delete(timerfindall).

Input arguments

Name, Value
Property name and the value to match.

Output arguments

out
Array of timers, or an empty value if there are none.

Example

Counting timers

t1 = timer('TimerFcn', @(~,~) disp('a'));
t2 = timer('TimerFcn', @(~,~) disp('b'));
disp(numel(timerfindall))
delete(timerfindall)
disp(isvalid(t1))
Output
     2
   0

See also

timerfind timer delete isvalid