Problem with datestr e datenum

1 回表示 (過去 30 日間)
Arthur
Arthur 2012 年 12 月 7 日
Hello!
I have a code that read a xls file and get a colum of dates:
data_even ---- 60x1 cell
' 31/10/2012'
' 31/10/2012'
' 01/11/2012'
' 01/11/2012' .....
I want to compare some dates, so i need to convert it using datenum() and when i return to string for my conference i see a diferece way to show the date, take a look:
>> x = datenum(data_even)
13608
13608
734879
734879
>> y = datestr(x,'dd/mm/yyyy')
03/04/0037
03/04/0037
11/01/2012
11/01/2012
Someone help me please.
I try to convert the data_even vector to string from a cell and here the result:
>> datestr(data_even,'dd/mm/yyyy')
03/04/0037
03/04/0037
11/01/2012
11/01/2012
the same problem occurs!

採用された回答

Matt Fig
Matt Fig 2012 年 12 月 7 日
編集済み: Matt Fig 2012 年 12 月 7 日
>> data_even = {' 31/10/2012'
' 31/10/2012'
' 01/11/2012'
' 01/11/2012'};
>> x = datenum(data_even,'dd/mm/yyyy')
x =
735173
735173
735174
735174
>> y = datestr(x,'dd/mm/yyyy')
y =
31/10/2012
31/10/2012
01/11/2012
01/11/2012
  1 件のコメント
Arthur
Arthur 2012 年 12 月 7 日
Thanks a lot Matt.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTime Series Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by