tiled plots on two loops without overriding the succesive figures

1 view (last 30 days)
juan sanchez
juan sanchez on 29 Nov 2021
Edited: Cris LaPierre on 28 Dec 2021
I have arranged the tiled plots in the following way inside two loops so that the figures from the first loop don't over write the figures of the second loop. Is there any better way to do this? This code appears to work but I will like your opinion if there is a better way of doing this.
Is the tiledlayout and nexttile application properly applied here?
NP = 16; % 16 probes per page
[NRow, N_probe] = size(V_possible);
for k_page = 1: ceil(N_probe/NP)
screensize = get( groot, 'Screensize' );
figure('Position', screensize)
tiledlayout('flow','TileSpacing', 'Compact', 'Padding', 'Compact');
if k_page == ceil(N_probe/NP)
nplot = N_probe-NP*(k_page-1);% plots per page, last page could be less than 20
else
nplot = NP;
end
for kk= 1:nplot
nexttile(kk)
i_probe = NP*(k_page-1)+kk;
loglog(nraw1,sraw1,'-.b','LineWidth',1);
hold on
loglog(nraw2,sraw2,'-.r','LineWidth',1);
hold on
end %for kk
end %for k_page
for k_page = 1: ceil(N_probe/NP)
screensize = get( groot, 'Screensize' );
figure('Position', screensize)
tiledlayout('flow','TileSpacing', 'Compact', 'Padding', 'Compact');
if k_page == ceil(N_probe/NP)
nplot = N_probe-NP*(k_page-1);% plots per page, last page could be less than 20
else
nplot = NP;
end
for kk= 1:nplot
nexttile(kk)
i_probe = NP*(k_page-1)+kk;
loglog(nraw3,sraw3,'-.b','LineWidth',1);
hold on
loglog(nraw4,sraw4,'-.r','LineWidth',1);
hold on
end %for kk
end %for k_page

Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!