convert seconds to time
古いコメントを表示
Hi Team,
I have an array of numbers, which represents the number of seconds from 12am. Is there any way that I could convert seconds into time.
For example; 28225.6 is the number format I have, which is represents 28225.6 seconds after 12am. That is 7:50:25 AM in time.
Thank you
採用された回答
その他の回答 (1 件)
Peter Perkins
2018 年 1 月 5 日
Unless you are using an older version of MATLAB, use durations:
>> seconds(28225.6)
ans =
duration
28225.6 sec
2 件のコメント
Matlab Newbee
2018 年 1 月 8 日
Peter Perkins
2018 年 1 月 9 日
From your other post, it looks like you'd probably want those to display as h:m:s. Either set the format after calling seconds, or just call duration.
>> s = seconds(28225.6)
s =
duration
28226 sec
>> s.Format = 'hh:mm:ss.SSS'
s =
duration
07:50:25.600
>> s = duration(0,0,28225.6)
s =
duration
07:50:25
カテゴリ
ヘルプ センター および File Exchange で Dates and Time についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!