%% Find Timer Objects Existing in Memory
% Create several individual timers and an array of timers.

t1 = timer('Tag','broadcastProgress','UserData','Monday');
t2 = timer('Tag','displayProgress','UserData','Monday');
timerArr = [timer('Tag','broadcastProgress','UserData','Tuesday');
    timer('Tag','displayProgress','UserData','Tuesday');
    timer('Tag','displayProgress','UserData','Wednesday');];

%
% Find all the timers in memory.

out1 = timerfind

%
% Find only those timers in memory that have the Tag property value  'displayProgress'.

out2 = timerfind('Tag','displayProgress')

%
% Limit the search for timers to timer objects in timerArr with the  Tag property value 'displayProgress'.

out3 = timerfind(timerArr,'Tag','displayProgress')

%
% Define a struct containing the Tag and UserData properties of interest.

searchStruct = struct('Tag','broadcastProgress','UserData','Monday')

%
% Use the struct as the search criteria to find timer objects in memory.

out4 = timerfind(searchStruct)

%
% Delete the timer objects.

delete(t1)
delete(t2)
delete(timerArr)

% Copyright 2012 The MathWorks, Inc.