Date/Time Processing and Formatting Issues
Mostrar comentarios más antiguos
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 comentario
F_M
el 5 de Oct. de 2022
Movida: Star Strider
el 5 de Oct. de 2022
Respuesta aceptada
Más respuestas (1)
millercommamatt
el 4 de Oct. de 2022
dt = datetime(x,'InputFormat', 'yyyy:DDD:HH:MM:ss.SSSSSSSSS');
3 comentarios
F_M
el 4 de Oct. de 2022
millercommamatt
el 4 de Oct. de 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
el 4 de Oct. de 2022
Categorías
Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
