repeating a script every two minutes

1 visualización (últimos 30 días)
AA
AA el 14 de Feb. de 2015
Comentada: AA el 17 de Feb. de 2015
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);
Someone posted the above code and it works fine when I replace disp with another function. How can I run a script instead of a function every 2 minutes?

Respuestas (1)

Image Analyst
Image Analyst el 14 de Feb. de 2015
I know it seems kind of obvious, but what happened when you just put the name of your script instead of "disp('hi')"? Did that not work?
  1 comentario
AA
AA el 17 de Feb. de 2015
nah it doesnt work. i have got two external variables q and a must be read by the function. i get the following error:
Undefined function or variable 'q'.

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by