How to plot each row separately

5 ビュー (過去 30 日間)
Nivodi
Nivodi 2018 年 9 月 20 日
コメント済み: KSSV 2018 年 9 月 20 日
Hello everybody, I need your help, please. I have a table "T"(double) with 189 rows and 9 columns (variables) and I have to plot Var2 in function of V3, Var4 in function of Var5 and so on in the same graph but each row separately to a different graph (I guess I have to use 'clf'). The attached image is what I want as a result ( I did it with excel). Thank you in advance!

回答 (1 件)

KSSV
KSSV 2018 年 9 月 20 日
A = rand(50,3) ;
x = 1:size(A,1) ;
figure
hold on
for i = 1:size(A,2)
plot(x,A(:,i))
end
legend
figure
plot(x,A)
legend
  4 件のコメント
KSSV
KSSV 2018 年 9 月 20 日
You need not to give x axes data. In such case, plot will be wrt to indices.
KSSV
KSSV 2018 年 9 月 20 日
YOur Table should be called as T.(i)

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by