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

1 Ansicht (letzte 30 Tage)
Fahmy Shandy
Fahmy Shandy am 18 Dez. 2019
Beantwortet: Walter Roberson am 18 Dez. 2019
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

Antworten (1)

Walter Roberson
Walter Roberson am 18 Dez. 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}

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by