conversion of a date/time column into serial date number and seperate time column
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a table in table format and it has 6 columns and 6 million rows.
The first column has dates and time in such a format '20050103 014800' which stands for 3rd January 2005 01:48:00.
I want the date of the first column to be converted into a date serial number which can be recognized by matlab (ie. via datenum). The time section I want to put into a seperate adjacent column in the format 00:00-->0, 00:01-->1 up until 23:59-->1439. can anyone help me? thanks
댓글 수: 0
채택된 답변
Ingrid
2015년 10월 28일
use datenum and a format specifier (assuming X is your variable and Y is the requested variable)
numFormat = datenum(X{:,1},'yyyymmdd HHMMSS');
Y(:,1)= round(numFormat);
Y(:,2)= hour(numFormat)*60 + minute(numFormat);
댓글 수: 2
Ingrid
2015년 10월 28일
indeed a very valid remark, you just want to remove the values after the point and not use round, sorry for my mistake
참고 항목
카테고리
Help Center 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!