Filter löschen
Filter löschen

out of scope timer or not saved to variable

3 Ansichten (letzte 30 Tage)
Ali Omar
Ali Omar am 25 Aug. 2011
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

Akzeptierte Antwort

Paulo Silva
Paulo Silva am 25 Aug. 2011
delete(timerfindall) %if you only have that timer
%timerfindall is a MATLAB function
  2 Kommentare
Ali Omar
Ali Omar am 25 Aug. 2011
that was fast, precise and did the trick..... thanx
Paulo Silva
Paulo Silva am 25 Aug. 2011
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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by