subplot with for loop after 10 new figure
3 views (last 30 days)
Show older comments
Hi,
I plot subplots with a for loop. After 10 subplots I want a new figure with the next 10 subplots an so on. At the end there shold be a number of figures each 10 subplots.
Thanks in advance.
Here my code:
for i=1:10
sgtitle('WSPL zeitlicher Verlauf Modell D Teil 1')
subplot(10,1,i)
hold on
p1=plot (col2_Z(:,i) , [col3_Z(:,i), col3_HQextrem(:,i), col3_HQ5000(:,i), col3_HQ10000(:,i)]);
title(['Zeit [h] ', num2str(i)])
grid on
leg=legend(p1,{'Geländehöhe','HQextrem','HQ5000', 'HQ10000'})
title(leg,'WSPL')
newcolors = {'#000000','#7E2F8E','#0000FF','#00FFFF'};
colororder(newcolors)
end
0 Comments
Accepted Answer
Chunru
on 4 May 2022
for i=1:100 % any number
if rem(i-1, 10) == 0
figure;
end
sgtitle('WSPL zeitlicher Verlauf Modell D Teil 1')
subplot(10, 1, rem(i-1, 10)+1);
hold on
p1=plot (col2_Z(:,i) , [col3_Z(:,i), col3_HQextrem(:,i), col3_HQ5000(:,i), col3_HQ10000(:,i)]);
title(['Zeit [h] ', num2str(i)])
grid on
leg=legend(p1,{'Geländehöhe','HQextrem','HQ5000', 'HQ10000'})
title(leg,'WSPL')
newcolors = {'#000000','#7E2F8E','#0000FF','#00FFFF'};
colororder(newcolors)
end
0 Comments
More Answers (0)
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!