date conversions from yyyydddhhmmss to the number format

3 ビュー (過去 30 日間)
Jack Shue
Jack Shue 2019 年 6 月 24 日
編集済み: Adam Danz 2019 年 6 月 24 日
I have a different date format that I need to convert to the "number" format. What I have is
Data 2018:335:00:00:11 4.4960559400000193E+00 1.1337406300000055E+00
I have many lines of txt. How do I convert this one? Columns 3 & 4 are data taged at the time. The format seems to be yyyy.ddd.hh.mm.ss

採用された回答

Adam Danz
Adam Danz 2019 年 6 月 24 日
編集済み: Adam Danz 2019 年 6 月 24 日
Assuming you've already isolated the datetime strings,
% Convert string to datetime
dtstr = '2018:335:00:00:11';
dt = datetime(dtstr,'InputFormat', 'u:D:HH:mm:ss');
% if you want that in serial date format
n = datenum(dt);
If you need help isolating the strings, leave a comment (hint: regexp).
Note that the string format uses "D" for day-of-year and "u" for ISO-year in place of the Gregorian year (y).

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by