how to plot from CSV files?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lilya
am 19 Mai 2024
Kommentiert: Star Strider
am 20 Mai 2024
Hi all,
I have some data as CSV and want to plot the time (col. 1,2) in x-axis with temperature (col. 3) in y-axis (screenshot)
how to :
- access the data
- plot the data
thanks!!
0 Kommentare
Akzeptierte Antwort
Star Strider
am 19 Mai 2024
It would help to have your data rather than an image of it.
In the interim, try something like this —
imshow(imread('Screen Shot 20....42.20 PM.png'))
% T1 = readtable('YourFile.csv')
T1 = table(['16/02/2024';'16/02/2024'], ["11:37:39AM"; "11:37:40AM"], [11.9420; 11.9440], 'VariableNames',{'LogInterval','VarName2','VarName3'})
LogTime = datetime(T1.LogInterval, 'InputFormat','dd/MM/yyyy') + timeofday(datetime(T1.VarName2, 'InputFormat','hh:mm:ssa'))
LogTime.Format = 'yyyy/MM/dd HH:mm:ss'
T1 = addvars(T1, LogTime, 'Before',1)
T1 = removevars(T1,[2 3])
VN = T1.Properties.VariableNames;
figure
plot(T1.LogTime, T1.VarName3)
grid
xlabel(VN{1})
ylabel(VN{2})
That should work.
.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Language Fundamentals 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!