timerfind
Finds valid timer objects, optionally filtered by property values.
Category: Programming > Programming Utilities
Syntax
out = timerfind
Returns all timer objects that are valid.
out = timerfind(Name, Value, ...)
Returns only the timers whose properties match the given values.
Description
Timers belong to the session, not to a variable, so a timer whose variable was cleared can still be running. timerfind locates it again, typically to stop and delete it. Giving the Name property when creating timers makes them easy to pick out later.
Input arguments
Name, Value- Property name and the value to match, such as
'Name', 'mytimer'.
Output arguments
out- Array of matching timers, or an empty value if there are none.
Example
Looking up a timer by name
t = timer('Name', 'mytimer', 'TimerFcn', @(~,~) disp('x'));
f = timerfind('Name', 'mytimer');
disp(numel(f))
disp(f.Name)
delete(t)
Output
1
mytimer