필터 지우기
필터 지우기

Display elapsed time in hours, minutes, and seconds

조회 수: 40 (최근 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 CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by