TIMER still runs after deleting the variable
Ältere Kommentare anzeigen
currentTimeSecs = rem(now,1)*24*60*60;
fireTimerAtSecs = 15*60*60;
if currentTimeSecs < fireTimerAtSecs
% timer will fire today
timerDelaySecs = fireTimerAtSecs - currentTimeSecs;
else
% timer will fire tomorrow
timerDelaySecs = (24*60*60 - currentTimeSecs) + fireTimerAtSecs;
end
T = timer('Period',120, ...
'ExecutionMode','fixedRate', ...
'StartDelay', timerDelaySecs, ...
'TimerFcn',@(src,evt)disp('hi'));
start(T);
When I run the above code and then delete the variable T then the script still continues running and executing the function disp(hi). How can I stop that? how can i stop the timer?
Akzeptierte Antwort
Weitere Antworten (1)
Geoff Hayes
am 1 Feb. 2015
AA - to stop the timer T, call
stop(T);
Kategorien
Mehr zu Programming Utilities finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!