How to put time column at X axis from timetable against column 2,3,4 Y axis.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sheikh Khaleduzzaman
am 6 Dez. 2023
Kommentiert: Star Strider
am 7 Dez. 2023
I have the following timetable data. I like to plot the graph where X axis is Time column and Y axis are Column 1(var1_switch),2,3,and 4. Please help. I like to see the code where time will plot on X axis from start to end without giving the timerange becase I have several sheet like this where start and end date are different. Thanks
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1561409/image.png)
0 Kommentare
Akzeptierte Antwort
Star Strider
am 6 Dez. 2023
Perhaps something like this —
TT = readtable(path_to_file);
TT.Time = datetime(TT.Time, 'InputFormat','yyyy-MM-dd''T''HH:mm:ss.SSS', 'Format','yyyy-MM-dd HH:mm:ss.SSS', 'TimeZone','UCT')
VN = TT.Properties.VariableNames;
figure
plot(TT.Time, TT{:,[1 2 3]})
grid
xlabel('Time')
ylabel('Value')
legend(VN(1:3), 'Location','best')
.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Line Plots 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!