How to separate date and time into two tables?
Ältere Kommentare anzeigen
Hi, i am new to Matlab. I have a problem with separating imported data of date and time over the year (8760 values) into two tables. Imported data looks like this. Its a cell of data in one column and i need to separate it to date in one table and time in second table.
'01/01 01:00:00'
'01/01 02:00:00'
'01/01 03:00:00'
.
.
'12/31 22:00:00'
'12/31 23:00:00'
'12/31 24:00:00'
Thank you for any help.
Akzeptierte Antwort
Weitere Antworten (1)
Marc Jakobi
am 25 Okt. 2016
Bearbeitet: Marc Jakobi
am 25 Okt. 2016
What format do you need the dates in? As strings? If not, I would recommend using datevec() to convert it to a matrix in the form:
[year, month, day, h, min, s]
so for example:
v = datevec(timestamp, 'mm/dd HH:MM:SS');
You can then separate v(1:3,:) (year, month & day) and v(4:6,:) (hours, minutes & seconds).
3 Kommentare
LamaObecna
am 25 Okt. 2016
Walter Roberson
am 25 Okt. 2016
replace timestamp by the name of your variable that has the time strings.
Steph
am 17 Feb. 2019
how do I extract date and time variables in 2 seperate columns from a datevector that is 6 by double?
Kategorien
Mehr zu Time Series Objects finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!