I have problem with detevec.

1 回表示 (過去 30 日間)
Andrea
Andrea 2013 年 3 月 5 日
Hi,
I want to read a='7/17/10 20:36' from excel to MATLAB.
b=datevec(a,'mm/dd/yy HH:MM');
I did that but I ended up having '7/17/2010 8:36:00 PM' but I want to have '7/17/2010 20:36'.
any help please?

採用された回答

Walter Roberson
Walter Roberson 2013 年 3 月 5 日
You used datevec() which returns numeric contents not strings.
>> datevec(a,'mm/dd/yy HH:MM')
ans =
2010 7 17 20 36 0
You must have used datestr() to get the string; in that case use the format that you want
>> datestr(datevec(a,'mm/dd/yy HH:MM'), 'mm/dd/yy HH:MM')
ans =
07/17/10 20:36

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by