Date/Time Processing and Formatting Issues
古いコメントを表示
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 件のコメント
F_M
2022 年 10 月 5 日
移動済み: Star Strider
2022 年 10 月 5 日
採用された回答
その他の回答 (1 件)
millercommamatt
2022 年 10 月 4 日
dt = datetime(x,'InputFormat', 'yyyy:DDD:HH:MM:ss.SSSSSSSSS');
3 件のコメント
F_M
2022 年 10 月 4 日
millercommamatt
2022 年 10 月 4 日
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
2022 年 10 月 4 日
カテゴリ
ヘルプ センター および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
