This is the change I made to Bruno's code, which seems to be working standalone. Meaning, it's been implemented outside of the gui.
% Generate a fig file
close all;
figure(1);
clf(1);
axsource=axes('Parent',1);
h = struct2handle(data.T1,0)
saveas(gcf,'sourcefig.fig')
% 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);
for ii = 1:length(tmpaxes)
destaxes(ii)=subplot(3,8,ii,'Parent',2)
copyobj(allchild(tmpaxes(ii)),destaxes(ii));
end
% Clean up
close(h)
However, when I try to implement within my gui, I am unable to plot all subplots simultaneously in the gui figure. Here is what I am doing:
% Copy the axe
for ii = 1:length(tmpaxes)
destaxes(ii)=subplot(3,8,ii,'Parent',double(gui.PlotBox1));
copyobj(allchild(tmpaxes(ii)),destaxes(ii));
end
Having gone through it in debug mode, I see that each subplot is plotted but cleared through every iteration of the loop. "hold on;" does not seem to work. Any suggestions?