date time to datenum
1 回表示 (過去 30 日間)
古いコメントを表示
I have an array of time series in the format dd-mm-yyyy hh:mm:ss, I want to convert it to datenum:
'29-May-1930 00:00:00'
'29-May-1930 01:00:00'
'29-May-1930 02:00:00'
'29-May-1930 03:00:00'
'29-May-1930 04:00:00'
'29-May-1930 05:00:00'
'29-May-1930 06:00:00'
'29-May-1930 07:00:00'
'29-May-1930 08:00:00'
'29-May-1930 09:00:00'
'29-May-1930 10:00:00'
How to do so?
0 件のコメント
採用された回答
Adam
2017 年 8 月 15 日
What is wrong with the obvious
res = datenum( yourData );
?
2 件のコメント
Stephen23
2017 年 8 月 15 日
編集済み: Stephen23
2017 年 8 月 15 日
@Poulomi Ganguli: Did you notice that yyyy-mm-dd is arranged in a totally different order to your dates? And is missing the hour, minute, and second units? Instead of guessing what format string to use and getting it wrong, you could simply read the documentation:
and then try:
dd-mmm-yyyy HH:MM:SS
For example:
>> datenum('29-May-1930 00:00:00','dd-mmm-yyyy HH:MM:SS')
ans = 705067
その他の回答 (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!