Clear Filters
Clear Filters

How to convert Matlab figures into subplots without having to redraw the plots again in the command window?

6 views (last 30 days)
hello
I have a number of Matlab figures that I want to convert to subplots without having to redraw the figures in the command window . I know there is a function called subplot and tilelayout, is there a way that a Matlab figure can be converted by copying the axis of each figure into the respective tile within the tiled layout ?

Accepted Answer

Paul
Paul on 7 Apr 2024
Use copyobj to copy the axes of interest to a new figure, then arrange with subplot
figure
plot(rand(3))
ax0 = gca;
hnew = figure;
ax1 = copyobj(ax0,hnew);
subplot(3,1,1,ax1)
% show that we can copy another axes into the same figure.
ax3 = copyobj(ax0,hnew);
subplot(3,1,3,ax3);

More Answers (0)

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!