matlab datenum to excel datetime

15 ビュー (過去 30 日間)
Adam
Adam 2013 年 2 月 20 日
コメント済み: Rik 2021 年 2 月 23 日
Hello Forum, This might really be an Excel question, but is there an Excel method that converts the Matlab datenum to an Excel date time, in Excel?
Thanks

回答 (3 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 2 月 20 日
編集済み: Azzi Abdelmalek 2013 年 2 月 20 日
That mean you are exporting your data from Matlab to Excell, then you can set the format you need in Matlab and export it to Excell file. Example
yourdates=datestr(datenum(2013,1,(1:365)),'dd-mmm-yyyy')
xlswrite('file.xls',cellstr(yourdates))
Then in Excell you can use other formats

Oleg Komarov
Oleg Komarov 2013 年 2 月 20 日
In MATLAB you can convert MATLAB datenums into EXCEL datenums with the function m2xdate(). Then export to excel and set the column with the serial dates to type date.

Jan
Jan 2013 年 2 月 20 日
What kind of "Excel date time" do you mean? The serial date number? See:
Please note, that Excel uses another start point for the serial datenumbers when run on Macs, 1904 instead of 1900. Isn't this cute?
  2 件のコメント
adams13
adams13 2021 年 2 月 23 日
Now it is even better, Excel for windows has a setting "Use 1904 date system". You have to activate it to let Excel show negative time differences (all the dates in the workbook will be changed if you change it).
So, if you whant to read/write the date from Matlab, you have to figure out which system is used in a particular file and provide correct parameter to
matlab_value = datetime(excel_value, 'ConvertFrom', 'excel')
matlab_value = datetime(excel_value, 'ConvertFrom', 'excel1904')
or another way
excel_value = exceltime(matlab_value, '1900')
excel_value = exceltime(matlab_value, '1904')
Rik
Rik 2021 年 2 月 23 日
As if you would need additional reasons to doubt the interoperability of Excel.

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

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by