out of scope timer or not saved to variable

1 回表示 (過去 30 日間)
Ali Omar
Ali Omar 2011 年 8 月 25 日
delete a timer that was not declared to a variable
start(timer('TimerFcn',@callbckfcn, 'StartDelay', 1, 'Period',5, 'ExecutionMode', 'fixedRate'));
delete a timer that was declared inside a function that has terminated
function fcn
t1 = timer('TimerFcn',@callbckfcn, 'StartDelay', 1, 'Period',5, 'ExecutionMode', 'fixedRate');
start(t1);
end

採用された回答

Paulo Silva
Paulo Silva 2011 年 8 月 25 日
delete(timerfindall) %if you only have that timer
%timerfindall is a MATLAB function
  2 件のコメント
Ali Omar
Ali Omar 2011 年 8 月 25 日
that was fast, precise and did the trick..... thanx
Paulo Silva
Paulo Silva 2011 年 8 月 25 日
You can also create timers with something in their Tag property and find them with timerfind
timer('TimerFcn','disp(1)', 'StartDelay', 1,...
'Period',5, 'ExecutionMode', 'fixedRate','Tag','MyTimer')
%just in case it's running (no warnings using the delete function)
stop(timerfind('Tag','MyTimer'))
delete(timerfind('Tag','MyTimer')) %it's stopped so you can now delete it

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by