【问题标题】:How can I instantiate one .fig file onto another in MATLAB?如何在 MATLAB 中将一个 .fig 文件实例化到另一个文件上?
【发布时间】:2011-09-16 13:44:36
【问题描述】:

我有一个 block.fig 文件,它封装了我的图形用户界面 (GUI) 的一些块。 我想创建一个full.fig 文件,它使用封装在block.fig 中的该GUI 的许多实例。

我该怎么做?

【问题讨论】:

    标签: matlab hierarchy figure matlab-guide


    【解决方案1】:

    您不太清楚以下是否适用,但也许您可以通过从加载的图形中选择组件(带有FINDOBJ)并将它们复制/移动到新图形来调整this answer 以适应类似的问题.

    一个简单的例子:

    %# 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)
    

    【讨论】:

      猜你喜欢
      • 2021-11-09
      • 1970-01-01
      • 1970-01-01
      • 2012-03-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-24
      • 2017-04-06
      相关资源
      最近更新 更多