repeating a script every two minutes

조회 수: 2 (최근 30일)
AA
AA 2015년 2월 14일
댓글: AA 2015년 2월 17일
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?

답변 (1개)

Image Analyst
Image Analyst 2015년 2월 14일
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
AA
AA 2015년 2월 17일
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'.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Code Execution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by