Is it possible to create a plot from a table?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hans Lipton
am 1 Nov. 2021
Kommentiert: Star Strider
am 1 Nov. 2021
I have a table and I'd like to create several plots from it.
Is it easier to create a plot from a table or matrix?
0 Kommentare
Akzeptierte Antwort
Star Strider
am 1 Nov. 2021
Creating a plot from a table is straightforward, although the references are different —
T1 = array2table(randi(99, 5,3), 'VariableNames',{'Column 1','X','v'})
figure
plot(T1.('Column 1'), T1.X, 'p')
hold on
plot(T1.('Column 1'), T1.v, 's')
hold off
grid
If the first column is a datetime array, this is also straightforward —
T2 = table(datetime([2021 11 01])+days(0:4).', rand(5,1), randn(5,1))
figure
plot(T2{:,1}, T2{:,2}, 'p')
hold on
plot(T2{:,1}, T2{:,3}, 's')
hold off
grid
.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D 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!