필터 지우기
필터 지우기

opening multiple figures with a single gui

조회 수: 5 (최근 30일)
as banga
as banga 2011년 6월 25일
hey, i want to make a GUI ,on starting it will show 3 push buttons, clicking on first push button opens a figure with some axes and some edit texts objects there. similarly on clicking the second figure. on clicking the third push button,a figure opens which uses the data entered on first and second figures. i am confused, how to do it, i want all the figures open at the same time. can any one please explain with a simple example.

답변 (2개)

Paulo Silva
Paulo Silva 2011년 6월 25일
Too many questions and nothing done so far, here's a simple GUI that adds the value you put in the textbox of GUI1 with the one from GUI2, don't close GUI1 and GUI2, just minimize them, press the button GUI3 on the main GUI and you will see the sum on the textbox of the GUI3
function testmgui
figure
pbh1 = uicontrol(gcf,'Style','pushbutton','String','GUI 1',...
'Position',[10 60 60 40],...
'callback',@gui1);
pbh2 = uicontrol(gcf,'Style','pushbutton','String','GUI 2',...
'Position',[10 90 60 40],...
'callback',@gui2);
pbh3 = uicontrol(gcf,'Style','pushbutton','String','GUI 3',...
'Position',[10 120 60 40],...
'callback',@gui3);
function gui1(obj,event)
figure
txt1 = uicontrol(gcf,'Style','edit','String','1',...
'Position',[10 90 60 40]);
set(txt1,'Tag','txt1')
end
function gui2(obj,event)
figure
txt1 = uicontrol(gcf,'Style','edit','String','2',...
'Position',[10 90 60 40]);
set(txt1,'Tag','txt2')
end
function gui3(obj,event)
figure
txt3 = uicontrol(gcf,'Style','edit',...
'Position',[10 90 60 40]);
txt1=findall(0,'Tag','txt1');
txt2=findall(0,'Tag','txt2');
stxt1=get(txt1,'String')
stxt2=get(txt2,'String')
set(txt3,'String',num2str(str2num(stxt1)+str2num(stxt2)))
end
end
Here's also the best compilation of GUIs on the FEX: 41 Complete GUI Examples by Matt Fig

as banga
as banga 2011년 6월 30일
hey, i am currently studying making GUI with GUIDE. can anyone please explain how to do it

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by