How do you end a tiledlayout object

33 views (last 30 days)
Im using a live script to generate multiple figures for a project and am using tiledlayout for some of the plots. Im running into the issue where after I call the function and use all the tiles, I am unable to generate normal plots again without explicitly generating a new tiledlayout object of size 1x1. Instead it will either overwrite the last plot of the tiledlayout or do some weird stuff. Is there anyway to stop the tiled layout?

Accepted Answer

Cris LaPierre
Cris LaPierre on 13 Dec 2020
Use figure to create a new figure window for plotting the next plot.
Live scripts will continue to use the same figure for all plotting unless you explicitly create a new one. If you use section breaks, what you see in each section are snapshots of the same figure, rather than new figures (unless you've created it with figure).
tiledlayout(1,2);
[X,Y,Z] = peaks(20);
% Tile 1
nexttile
surf(X,Y,Z)
% Tile 2
nexttile
contour(X,Y,Z)
% New plot
figure
x=1:5;
y=x.^2;
plot(x,y)

More Answers (0)

Categories

Find more on Axes Appearance 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!