opening multiple figures with a single gui
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Antworten (2)
Paulo Silva
am 25 Jun. 2011
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
0 Kommentare
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!