How to make a subplot into a new standalone figure?

98 views (last 30 days)
A colleague is giving me several fig files, each of which contains several subplots. What is the way that I can "copy" a subplot to a new standalone figure, including lines, x/y labels, and title? I would like to insert this in the following code, so I can automatically generate a figure for every subplot in the workspace.
% Make some fake figures
for iFig = 1:3
for iSub = 1:4
% Get handles to all subplots
hAx = findobj('type', 'axes');
for iAx = 1:length(hAx)
% Do something here to generate a new figure containing
% lines/labels copied from this axis

Accepted Answer

Sean de Wolski
Sean de Wolski on 27 Feb 2014
You'll want to use copyobj.
This MathWorks' TS Answer might help get you started.
Ash Ash
Ash Ash on 12 Jul 2020
Thank you! This code solved my problem. All I needed to do was to tweak the axes position values to fit my monitor resolution.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!