Is it possible to create a plot from a table?

10 ビュー (過去 30 日間)
Hans Lipton
Hans Lipton 2021 年 11 月 1 日
コメント済み: Star Strider 2021 年 11 月 1 日
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 件のコメント
Hans Lipton
Hans Lipton 2021 年 11 月 1 日
Thank you very much! Helps a lot.
Star Strider
Star Strider 2021 年 11 月 1 日
As always, my pleasure!
.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by