Importing .fig with subplots into GUI
Show older comments
Hi,
I am trying to implement a solution posted by Bruno Luong that I found here. His solution is as follows:
% Generate a fig file
close all;
figure(1);
clf(1);
axsource=axes('Parent',1);
plot(axsource,rand(10,1));
hgsave(1,'sourcefig.fig');
close all;
% Load the fig file
h=hgload('sourcefig.fig');
set(h,'Visible','off');
tmpaxes=findobj(h,'Type','axes');
% Copy the axe
figure(2);
destaxes=subplot(2,2,1,'Parent',2)
copyobj(allchild(tmpaxes),destaxes);
% Clean up
close(h)
% Bruno
I think I have an understanding of what he is doing. What I would like to do is import a previously saved .fig file with 24 subplots (3,8,x) into a gui. I am using Bruno's example to do this by copying one subplot handle at a time and transferring to the new axes. I'm still having some issues but am working towards the solution. Am I on the right path? Any suggestions would be greatly appreciated. Thank you!
Answers (0)
Categories
Find more on Subplots 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!