Convert datetime into seperate columns

조회 수: 1 (최근 30일)
Yoni Verhaegen -WE-1718-
Yoni Verhaegen -WE-1718- 2020년 7월 25일
편집: Brittany Scheid 2020년 7월 25일
I have a CSV table that I load in Matlab and looks as follows (see below). I would like to separate the datetime column into separate values in the form of a double array, with 1 column for 'year', 1 column for 'month', and 1 column for 'day', something like:
2020 | 07 | 20
2020 | 07 | 20
The hour is not important. How can I do this? I attach the CSV file which can be loaded as:
seawatertemp_westhinder = readtable('seawatertemp_westhinder.csv');

채택된 답변

Brittany Scheid
Brittany Scheid 2020년 7월 25일
편집: Brittany Scheid 2020년 7월 25일
In one line to get a double array:
[y,m,d] = ymd(seawatertemp_westhinder.times);
% Add to table
seawatertemp_westhinder.year= y
seawatertemp_westhinder.month = m d

추가 답변 (0개)


Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by