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

1 view (last 30 days)
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

Answers (1)

Walter Roberson
Walter Roberson on 18 Dec 2019
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}

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!