How to continue subplot within for loop to another for loop?
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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}
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!