Is it possible to convert a duration array to something else like a number or string?
25 ビュー (過去 30 日間)
古いコメントを表示
Gustavo Silva
2016 年 12 月 19 日
回答済み: Mohammad Kifayath Chowdhury
2021 年 4 月 16 日
When finding the difference between two datetime scalars the result is a duration array. And i need it to be a double or a string.
0 件のコメント
採用された回答
Steven Lord
2016 年 12 月 19 日
編集済み: Steven Lord
2019 年 1 月 13 日
If you convert the duration to a double, what should it represent? The number of years, days, hours, minutes, seconds, or milliseconds that duration represents? See the functions that have those names on the documentation page to which I linked.
[Edited to update broken link.]
2 件のコメント
Bob Hay
2019 年 1 月 13 日
where is the link you refer to "See the functions that have those names on the documentation page to which I linked." the link retuns page not found I need the answer, how to convert duration back to datenum double. assume I'm using a 1x1 duration
Steven Lord
2019 年 1 月 13 日
The link broke. I updated it to point to the page listing the functions you can use to create or manipulate a datetime or duration array. See the links to the years, days, hours, minutes, seconds, and milliseconds documentation pages on that page.
その他の回答 (2 件)
Walter Roberson
2016 年 12 月 19 日
You can apply char() to a duration object. You can set the Format property of the duration object before using char()
0 件のコメント
Mohammad Kifayath Chowdhury
2021 年 4 月 16 日
This could be useful,
Tx=datetime(T1)-datetime(T2);
Tx=hours(Tx); This will give the hours value as double.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Dates and Time についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!