Is it possible to create a plot from a table?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Star Strider
2021-11-1
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
.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!