subplot with for loop after 10 new figure
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Chunru
le 4 Mai 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Subplots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!