Date/Time Processing and Formatting Issues
Ältere Kommentare anzeigen
I'm very new to MATLAB and have been reading tutorials and posts on plotting data from an external file (csv) and am having trouble processing date/time data. The CSV file has the date/time field as yyyy:ddd:hh:mm:ss.sssssssss (inculded sample below).
2022:246:10:00:02.593994140,4.44E+01
2022:246:10:00:03.592987060,-7.60E+01
2022:246:10:00:04.092987060,2.25E+02
I have tried several ways to plot the data but always run into an error when trying to convert the date/time string into date/time (I'm sure I'm missing a very basic/fundamental item), inculding different variations of u:DDD:HH:mm:ss.ms.
[data,txt,raw] = xlsread('test.csv');
x = txt{2:end,1};
y = raw(:,1) ;
dt = datetime(x,'InputFormat', 'u:DDD:HH:mm:ss.ms');
plot(dt,y)
Appreciate any help!
1 Kommentar
F_M
am 5 Okt. 2022
Verschoben: Star Strider
am 5 Okt. 2022
Akzeptierte Antwort
Weitere Antworten (1)
millercommamatt
am 4 Okt. 2022
dt = datetime(x,'InputFormat', 'yyyy:DDD:HH:MM:ss.SSSSSSSSS');
3 Kommentare
F_M
am 4 Okt. 2022
millercommamatt
am 4 Okt. 2022
That's what I get for not testing this before posting. This has the correct minute part of the format string
dt = datetime(x,'InputFormat', 'yyyy:DDD:HH:mm:ss.SSSSSSSSS');
F_M
am 4 Okt. 2022
Kategorien
Mehr zu Data Type Conversion 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!
