How can I instantiate one .fig file onto another in MATLAB?
I have a block.fig
file which encapsulates some block o开发者_StackOverflow中文版f my graphical user interface (GUI).
I want to create a full.fig
file which uses many instances of that GUI encapsulated in block.fig
.
How can I do this?
It's not very clear from you question whether the following applies, but maybe you can adapt this answer to a similar question by picking the components (with FINDOBJ) from the loaded figure and copy/move them to the new figure.
A quick example:
%# create and save block.fig
plot(1:10)
uicontrol('style','text','string','hello')
hgsave('block.fig')
close all
%# create new figure, load saved .fig
hFig = hgload('block.fig');
h = figure;
%# copy the components you want (also think of using the 'Tag' property)
copyobj(findobj(hFig,'type','uicontrol'), h)
%# delete loaded .fig
delete(hFig)
精彩评论