フィルターのクリア

Run a loop every hour regardless of its calculation time!

4 ビュー (過去 30 日間)
Sonima
Sonima 2019 年 3 月 23 日
コメント済み: Bruno Luong 2019 年 8 月 16 日
Hi All
I want to run a look evey hour and do some math inside the loop.
one solusion is to use tic/toc to get the math time and deduce it from the pause time, but I find it not efficient.
Any solusion to this?
Thanks.
  1 件のコメント
Stephen23
Stephen23 2019 年 8 月 16 日
編集済み: Stephen23 2019 年 8 月 16 日
Using tic / toc in a while loop is not very efficient.
Much better to use a timer object.

サインインしてコメントする。

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 3 月 23 日
編集済み: KALYAN ACHARJYA 2019 年 3 月 23 日
while true
tic
% some math here
elapsedTime=toc
pause(3600+elapsedTime);
clearvars elapsedTime;
end
% Please note on while loop to avoid infinite run
  3 件のコメント
Walter Roberson
Walter Roberson 2019 年 8 月 15 日
I would expect 3600-elapsedTime not 3600+elapsedTime
Bruno Luong
Bruno Luong 2019 年 8 月 16 日
Use timer is much better. I think PAUSE will lock completely 99% of MATLAB.

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 8 月 15 日

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by