Programming Utilities
Simple timer in MATLAB
Section titled “Simple timer in MATLAB”The following is a timer that fires at a fixed interval. It’s timeout is defined by Period and it invokes a callback defined by Timerfcn upon timeout.
t = timer;t.TasksToExecute = Inf;t.Period = 0.01; % timeout value in secondst.TimerFcn = @(myTimerObj, thisEvent)disp('hello'); % timer callback functiont.ExecutionMode = 'fixedRate';start(t)pause(inf);