フィルターのクリア

Display elapsed time in hours, minutes, and seconds

33 ビュー (過去 30 日間)
Kim Bostroem
Kim Bostroem 2023 年 4 月 19 日
コメント済み: chicken vector 2023 年 4 月 19 日
Since now datestr is discouraged, I would like to use datetime to display elapsed time in hours, minuts and seconds. My previous code was
datestr(toc, 'HH:MM:SS')
How can I replace this with a command using datetime?

採用された回答

chicken vector
chicken vector 2023 年 4 月 19 日
time = seconds(4321)
time.Format = 'hh:mm:ss'
  6 件のコメント
Kim Bostroem
Kim Bostroem 2023 年 4 月 19 日
I just noticed that one can even print milliseconds using
time = duration(0,0,toc, 'Format', 'hh:mm:ss.SSSS')
chicken vector
chicken vector 2023 年 4 月 19 日
the command seconds is returning an instance of the class duration, that's why you can include the 'Format' command in duration, but not in seconds.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by