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_testt1 = 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
Best Answer