%% Set Timer Objects Using Cell Arrays
% Create a cell array of properties to modify, and a cell array of the values of the corresponding properties. Instantiate a timer, and display the initial values of the properties in the property name cell array, nameArr.

nameArr = {'BusyMode','ExecutionMode','Period'};
valArr = {'queue','fixedDelay',3};
t = timer;
get(t,nameArr)

%
% Modify the timer object and display the new property values. Delete the timer.

set(t,nameArr,valArr)
get(t,nameArr)
delete(t)

%
% Instantiate an array of three timers. Create a new property name cell array to modify the BusyMode, ExecutionMode, and UserData properties. Display the initial values of the properties for each timer.

tArr = [timer timer timer];
nameArr = {'BusyMode','ExecutionMode','UserData'};
get(tArr,nameArr)

%
% Assign each property a different value in each timer. Create a cell array containing the new values. Each row indicates the values for the properties in the corresponding timer.

valArr = {'queue','fixedDelay',3;...
            'error','fixedSpacing',42;...
            'drop','fixedRate','hello'};

%
% Modify the timer object properties and display the updated values.

set(tArr,nameArr,valArr)
get(tArr,nameArr)

%
% Delete the timers from memory.

delete(tArr)

% Copyright 2015 The MathWorks, Inc.