Is it possible to create a plot from a table?

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?

 채택된 답변

Star Strider
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'})
T1 = 5×3 table
Column 1 X v ________ __ __ 96 28 50 36 18 31 49 44 45 58 69 59 91 54 62
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))
T2 = 5×3 table
Var1 Var2 Var3 ___________ ________ ________ 01-Nov-2021 0.099591 1.173 02-Nov-2021 0.35676 0.2072 03-Nov-2021 0.35601 0.58294 04-Nov-2021 0.38944 -0.63081 05-Nov-2021 0.1249 0.050471
figure
plot(T2{:,1}, T2{:,2}, 'p')
hold on
plot(T2{:,1}, T2{:,3}, 's')
hold off
grid
.

댓글 수: 2

Thank you very much! Helps a lot.
As always, my pleasure!
.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

릴리스

R2021a

태그

질문:

2021년 11월 1일

댓글:

2021년 11월 1일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by