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

6 ビュー (過去 30 日間)
Mandeguz
Mandeguz 2017 年 8 月 16 日
回答済み: Walter Roberson 2017 年 8 月 16 日
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 Center および File ExchangeMATLAB 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