How to close a GUI and open another GUI in the callback code ?

Let’s consider an application consisting of three GUIs: GUI1, GUI2, and GUI3. GUI1 contains two radio buttons included in a button group and two push buttons outside the button group one is named “Next” the other “Exit”. GUI1 is the starting GUI when the application is run, after doing the selection within the button group the user should go to the next GUI by pushing “Next” button or terminate the application by pushing “Exit” button.
The question:
How to close GUI1 and open (GUI2 or GUI3) (depending on selection) in the callback code of “Next” push button in GUI1, and How to terminate all the application in the callback code of “Exit” push button.

 採用された回答

Yao Li
Yao Li 2013 年 4 月 8 日

2 投票

switch get(handles.uipanel1,'SelectedObject') % Get Tag of selected object.
case handles.radiobutton1
close(GUI1);
run('Path_name\GUI2')
case handles.radiobutton2
%add your own codes
otherwise
end
Callbacks for push button Next

3 件のコメント

Digitalsd
Digitalsd 2013 年 4 月 9 日
編集済み: Digitalsd 2013 年 4 月 9 日
Exactly it is:
switch get(handles.uipanel1,'SelectedObject');
case handles.radiobutton1
close(gui1);
run('gui2');
case handles.radiobutton2
close(gui1);
run('gui3');
end
In the "Next" button callback. GUIs codes are in same path. Thanks
Wael Wanis
Wael Wanis 2019 年 8 月 11 日
why the close command doesn't work with me?
i know the answer was in 2013, there must have been changes in commands in MATLAB 2018, doesn anyone know how to close gui1 when opening gui2 ?
thank you
DhaniAri
DhaniAri 2020 年 1 月 29 日
function pushbutton1_Callback(hObject, eventdata, handles)
set(GUI1,'visible','off');
GUI2

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeInteractive Control and Callbacks についてさらに検索

質問済み:

2013 年 4 月 7 日

コメント済み:

2020 年 1 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by