Convert data table to datetime
123 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Raphael Willi
am 5 Mai 2021
Kommentiert: Raphael Willi
am 6 Mai 2021
I have data shown in the image.
I want to convert the second row into a datetime vector, but InputFormat doesn't work.
It's a number, e.g. 201401010000 meaning jan 1st 2014 00:00.
I tried datetime( BLA,'InputFormat','yyyyMMddHHmm')
0 Kommentare
Akzeptierte Antwort
Adam Danz
am 5 Mai 2021
Bearbeitet: Adam Danz
am 6 Mai 2021
> It's a number, e.g. 201401010000 meaning jan 1st 2014 00:00.
x = 201401010000;
dt = datetime(string(x),'InputFormat','yyyyMMddHHmm')
The 'format' property specifies the output format.
x can be a column of values.
3 Kommentare
Adam Danz
am 6 Mai 2021
> I want to convert the second row into a datetime vector
> I would like to e.g. convert it to a timetable
Those are two very different questions.
I've updated my answer. After converting the column to datetime use
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!