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

callbackclosing guiopening gui

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.

Best Answer

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