我有两个GUI-。
第一个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