How can I plot an existing MATLAB plots all in one figure using SUBPLOT
Show older comments
I have four figures which are already plotted by another user, but I do not have the commands that he used to plot them. I am trying to plot them all in one figure using SUBPLOT command.
Accepted Answer
More Answers (1)
Doug Hull
on 12 Jan 2011
3 Comments
Francesca Pisani
on 3 Aug 2023
This does not work for me. I get error:
Error using matlab.ui.Figure/get
Invalid or deleted object.
Error in microctd_turb_20apr (line 653)
hc = get(hf(i),'children')
@Francesca Pisani this code runs fine on online server as showed here:
Do not close manually he figure when it still running.
hf(1) = figure(1)
plot(peaks);
hf(2) = figure(2)
plot(membrane)
hf(3) = figure(3)
ha(1) = subplot(1,2,1);
ha(2) = subplot(1,2,2);
for i = 1:2
hc = get(hf(i),'children')
hgc = get(hc, 'children');
set(hgc, 'parent',ha(i));
end
Francesca Pisani
on 3 Aug 2023
Thank you, here it works, but if I apply this code to my need of creating a subplots with 4x2 figures it doesn't work. Please, if you could help me, I've just uploaded my question here https://it.mathworks.com/matlabcentral/answers/2004122-how-to-get-subplots-made-of-a-group-of-already-existing-fig
Categories
Find more on Graphics Object Properties in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

