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

5 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

Walter Roberson
Walter Roberson il 16 Ago 2017
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.

Più risposte (0)

Categorie

Scopri di più su MATLAB Support Package for Arduino Hardware in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by