date conversions from yyyydddhhmmss to the number format

조회 수: 1 (최근 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 CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by