subplot with for loop after 10 new figure

6 ビュー (過去 30 日間)
Frederik Reese
Frederik Reese 2022 年 5 月 4 日
回答済み: Chunru 2022 年 5 月 4 日
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

採用された回答

Chunru
Chunru 2022 年 5 月 4 日
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 件)

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by