MATLAB: Repeat a random function on matlab every 2 minutes

ttimer function repeat

i have a function called. I want it to be repeated every two minutes. how can i do that with a timer?

Best Answer

T = timer('Period',120,... %period
'ExecutionMode','fixedRate',... %{singleShot,fixedRate,fixedSpacing,fixedDelay}
'BusyMode','drop',... %{drop, error, queue}
'TasksToExecute',inf,...
'StartDelay',0,...
'TimerFcn',@(src,evt)disp('hi'),...
'StartFcn',[],...
'StopFcn',[],...
'ErrorFcn',[]);
start(T);
replace disp('hi') with something useful.