フィルターのクリア

Convert to MATLAB date number

1 回表示 (過去 30 日間)
Orion
Orion 2016 年 6 月 10 日
回答済み: Kelly Kearney 2016 年 6 月 10 日
How can I convert
'2015-033T18:00:00'
to Matlab date number? 033 is the day of year, i.e. Feb 2.

採用された回答

Kelly Kearney
Kelly Kearney 2016 年 6 月 10 日
If you have a newer version of Matlab, you can parse this directly to a datetime object
a = '2015-033T18:00:00';
d = datetime(a, 'InputFormat', 'yyyy-D''T''HH:mm:ss')
And if you need a datenumber instead:
dn = datenum(d)
For Matlab releases before 2014b, I think you'll have to parse manually:
tmp = textscan(a, '%f-%fT%f:%f:%f')
dn = datenum(tmp{1},1,1) + (tmp{2}-1) + tmp{3}/24 + tmp{4}/(24*60) + tmp{5}/(24*60*60)

その他の回答 (0 件)

カテゴリ

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