Merge saved figures into one figure in the same plot
Show older comments
I found this relevant question in this link: https://www.mathworks.com/matlabcentral/answers/478355-combine-three-or-more-matlab-figures
I was unable to replicate the code from user "meghannmarie" in the forum and my figures would not merge. It would produce a blank plot. I am new to this technique of combining figures on Matlab (I'm generally used to merging figures using "hold on" and then "plot," but I am unable to use this for my code) and any advice or additional information is much appreciated. I think the issue could be due to the axes being different, but I am not too sure because I am trying to understand what "children" and "parent" are. Thank you for your time.
fig = figure();
ax = axes(fig);
hold on
h1 = openfig('T_900K.fig','reuse');
h2 = openfig('T_1000K.fig','reuse');
h3 = openfig('T_1100K.fig','reuse');
h4 = openfig('T_1200K.fig','reuse');
h5 = openfig('T_1300K.fig','reuse');
h6 = openfig('T_1400K.fig','reuse');
copyobj(h1.Children.Children,ax);
copyobj(h2.Children.Children,ax);
copyobj(h3.Children.Children,ax);
copyobj(h4.Children.Children,ax);
copyobj(h5.Children.Children,ax);
copyobj(h6.Children.Children,ax);
close(h1);
close(h2);
close(h3);
close(h4);
close(h5);
close(h6);
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects 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!