Borrar filtros
Borrar filtros

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

7 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

Walter Roberson
Walter Roberson el 16 de Ag. de 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.

Más respuestas (0)

Categorías

Más información sobre MATLAB Support Package for Arduino Hardware en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by