How can I pause the execution of one timer while continuing to execute another timer in MATLAB 7.8 (R2009a)?
Show older comments
I have created two timer objects and I want to pause one them while the other one continues executing its Timer Function callback. I have put a pause in the Timer Function callback for the first timer, but that stopped execution of both timers:
function timer_pause_test
t1 = timer('TasksToExecute', 2,'ExecutionMode','fixedRate','TimerFcn',@tfunc1);
t2 = timer('TasksToExecute', 2,'ExecutionMode','fixedRate','TimerFcn',@tfunc2);
%start the timers
start(t1)
start(t2)
function tfunc1(obj, event)
disp('Timer ONE is executing')
function tfunc2(obj, event)
disp('Timer TWO is executing')
pause(5)
I observe that the PAUSE statement in the second timer's (t2) callback pauses both timers' execution:
Timer ONE is executing
Timer TWO is executing
% both timers pause for 5 seconds
Timer ONE is executing
Timer TWO is executing
% both timers pause for 5 seconds
Accepted Answer
More Answers (0)
Categories
Find more on Background and Parallel Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!