How to continue subplot within for loop to another for loop?

3 ビュー (過去 30 日間)
Fahmy Shandy
Fahmy Shandy 2019 年 12 月 18 日
回答済み: Walter Roberson 2019 年 12 月 18 日
I'm referring to this question :
Does anyone know about making subplot in two forloops, then combine them into one graph?
And refer to Cedric's answer, what if my problem like this:
figure() ;
for plotId = 1 : 5
subplot(2, 2, plotId) ;
plot(x{plotId}, y{plotId}) ;
end
figure() ;
for plotId = 6 : n
subplot(2, 2, plotId) ;
plot(x{plotId+4}, y{plotId+4}) ;
end
I separate those two forloops because of i have different method for solving each case, and it can't be united together for some reason (Multisteps method)
How can i do that?
When i try that script above, my code shows many graphs. And i just want the result shows one graph Not many graphs, and this graph must contains for i=1:n which is from 2 forloops that united together (1:5 + 6:n).
Please comment below if it's not clear. Thanks

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 12 月 18 日
Yes, that is certainly possible. However you need to change the 2, 2 first two parameters to p, q where p times q >= n . Also, remove the second figure() call.
Question: is it true that you do not want to plot x{6}, x{7}, x{8}, x{9} ? You skip from x{5} to x{6+4} which is x{10}

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by