Effacer les filtres
Effacer les filtres

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

7 vues (au cours des 30 derniers jours)
Mandeguz
Mandeguz le 16 Août 2017
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?

Réponse acceptée

Walter Roberson
Walter Roberson le 16 Août 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.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Support Package for Arduino Hardware dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by