Subplots using for loop with varying data increments
4 ビュー (過去 30 日間)
古いコメントを表示
JAGAN MOHAN KUMMARI
2020 年 4 月 27 日
コメント済み: JAGAN MOHAN KUMMARI
2020 年 4 月 28 日
Hi Friends,
I am reading the following data
d=xlsread('data.xlsx','sheet1')
t=d(:,1:4:5);
a=d(:,2:4:6);
v=d(:,3:4:7);
u=d(:,4:4:8);
how can I subplot this data to a 2x3 figures,
1 2 3
4 5 6
figs in Col1: 1:3:4 (1, 4) are with t, and a
figs in Col2: 2:3:5 (2, 5) are with t, and v
figs in Col3: 3:3:6 (3, 6) are with t, and u
Currently, I can plot them individually subplot but worried to making a mistake while creating each subplot in large data. Appreciate any ideas.
Thanks,
Jagan
2 件のコメント
採用された回答
Walter Roberson
2020 年 4 月 27 日
plotvars = {a, v, u};
for K = 1 : 3
subplot(2, 3, K)
plot(t, plotvars{K});
subplot(2, 3, K+3)
plot(t, plotvars{K});
end
12 件のコメント
Ameer Hamza
2020 年 4 月 28 日
Similarly, this will also work
y_limits={[-0.5 0.5],[-300 300],[-inf inf]};
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


