How do I delete the timer generated by the tic function?

5 次查看(过去 30 天)
When connecting to an arduino, oftentimes a timer will interrupt any commands I might have. Therefore, I've been deleting timers from my code and the arduino works well.
However, one process I have uses tic, but toc still returns the number of seconds from tic, even when I implement delete(timerfindall). Any hard clear-all functions that can do this for me?

采纳的回答

Walter Roberson
Walter Roberson 2017-8-16
does not create any timers. tic does the equivalent of
function current_time = tic
global tic_latest_time
current_time = now();
if nargout == 0
tic_latest_time = current_time;
end
and toc does the equivalent of
function elapsed_time = toc(tic_time)
global tic_latest_time;
current_time = now();
if nargin > 0
elapsed_time = current_time - tic_time;
else
elapsed_time = current_time - tic_latest_time;
end
except that a 64 bit integer timer is used instead of now(), and the resulting 64 bit difference is scaled into seconds.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Support Package for Arduino Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by