0

我有两个 GUI-s。

第一个 GUI 被命名为:GUI1,用户在其中插入三个值。

然后用户有一个“提交”按钮,所以我希望每次按下它时将这些值发送到其他功能(GUI2)。

我的函数 GUI2.m 获得三个元素:

function GUI2(x,y,r)
   .
   .
   .
end

这是第一个 GUI:

function [E] = GUI1()
    num_of_columns = 3;


    E = [];  % In case the user closes the GUI.
    S.fh = figure('units','pixels',...
          'position',[500 500 850 100],...
          'menubar','none',...
          'name','Number Of Columns',...              
          'numbertitle','off',...
          'resize','off');
    num = 0;
    for i = 1:num_of_columns
        S.ed(i) = uicontrol('style','edit',...
             'units','pix',...
            'position',[num 60 100 30],...
            'string','');
        num = num + 500/num_of_columns;
        uicontrol(S.ed(1))  % Make the editbox active.
     end

     S.pb = uicontrol('style','pushbutton',...
             'units','pix',...
            'position',[290 20 180 30],...
            'string','Submit',...
            'callback',{@pb_call});

     uiwait(S.fh)  % Prevent all other processes from starting until closed.

     function [] = pb_call(varargin)
         % Callback for the pushbutton.
         E = get(S.ed(:),'string');
         E{1} = str2num(E{1});
         E{2} = str2num(E{2});
         E{3} = str2num(E{3});

在这一行中,我想将 E{1}、E{2} 和 E{3} 发送到 GUI2

     end
end
4

1 回答 1

1

怎么样:

GUI2(E{1},E{2},E{3}) 
于 2012-11-07T08:10:36.393 回答