How May I import date/time from Excel?

4 ビュー (過去 30 日間)
Soli
Soli 2014 年 5 月 26 日
コメント済み: Mahdi 2014 年 5 月 26 日
I have a time series in Excel sheet and would like to import it to MATLAB but the date variable becomes scientific numbers like this: 9.37500000000000e-05, 8.82352941176471e-05, 7.50000000000000e-05, 7.14285714285714e-05, I tried "datestr()" function to convert them into "mm/dd/yyyy" format but the output was "12 am" for all dates. How may I transfer date variable to MATLAB and have "mm/dd/yyyy" format?

回答 (1 件)

Mahdi
Mahdi 2014 年 5 月 26 日
Have you looked at this solution?
  2 件のコメント
Soli
Soli 2014 年 5 月 26 日
I used the "datestr(datenum(sprintf('%d',x),'yyyymmdd'),'dd-mm-yyyy')" while x was my date vector but I got the following error. Error using datenum (line 179) DATENUM failed.
Caused by: Error using dtstr2dtnummx Failed on converting date string to date number.
Mahdi
Mahdi 2014 年 5 月 26 日
I misread your question the first time! Have you tried using the datevec MATLAB function? Basically, just input the numbers that you're getting and it should convert it to what you want if I'm understanding the question correctly.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by