Datenum date conversion troubles
1 回表示 (過去 30 日間)
古いコメントを表示
I have a matlab file of timestamps called d that looks like this...
'7/31/2012 2:35:00 PM'
'7/31/2012 2:36:00 PM'
'7/31/2012 2:37:00 PM'
'7/31/2012 2:38:00 PM'
'7/31/2012 2:39:00 PM'
'7/31/2012 2:40:00 PM'
and I am trying to put these timestamps into matlab so I can graph the data. so I have tried
CR100.time = datenum(d(:,1),'mm/dd/yyyy HH:MM:SS Ww')
But I am getting the response...
??? Error using ==> datenum at 182 DATENUM failed.
Caused by: Error using ==> dtstr2dtnummx Failed on converting date string to date number.
Any clue how to import these timestamps?
Also do you know how I can save an excel file in a matlab script.
1 件のコメント
回答 (3 件)
the cyclist
2012 年 7 月 31 日
編集済み: the cyclist
2012 年 7 月 31 日
I suspect it is the 'Ww' that is tripping you up. Try
datenum(d,'mm/dd/yyyy HH:MM:SS PM')
0 件のコメント
Thomas
2012 年 7 月 31 日
Just try something like:
str={'7/31/2012 2:35:00 PM'
'7/31/2012 2:36:00 PM'
'7/31/2012 2:37:00 PM'
'7/31/2012 2:38:00 PM'
'7/31/2012 2:39:00 PM'
'7/31/2012 2:40:00 PM'}
date_time=datenum(str)
0 件のコメント
Aaron
2012 年 7 月 31 日
3 件のコメント
the cyclist
2012 年 7 月 31 日
My advice would be to use my code on subset of d [such as d(1:5), then d(6:10), etc] until you can identify some entries of d that are causing the problem.
参考
カテゴリ
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!