MATLAB: How to use one GUI to call many other GUI

guiguidematlab gui

Hi, I'm trying to create a main GUI that gives options to user. Each options when pressed will lead users to another GUI. I only managed to do this when there is only 1 option in the main GUI using this simple code:
pushbutton1_Callback(option1);
option1;
However when i try to add more options to my main GUI it doesn't work. Below is the code:
pushbutton1_Callback(option1);
option1;
pushbutton2_Callback(option2);
option2;
pushbutton3_Callback(option3);
option3;
Using the above code, when pushbutton1 and pushbutton2 is pressed nothing happens. When pushbutton3 is pressed, all GUI for option1, option2, and option3 open in a infinite loop.
Hope if anyone have a solution to this. Thanks

Best Answer

Aloysius - what are the options? Do you have radio buttons that the user selects which is supposed to launch the new GUI, or do you have push buttons that the user presses to do the same? Please clarify and describe what the following code does (and where it is called from)
pushbutton1_Callback(option1);
option1;
The option1 variable (what type is this?) is passed to a pushbutton callback. Is this a custom callback that you have written? What does calling option1 on its own supposed to do?
Let's suppose that you have your main GUI, MyMainGui and your other GUI named MyOtherGui. If you have a push button on your main GUI that is supposed to launch the other GUI, then you would simply do
function pushbutton1_Callback(hObject,eventdata,handles)
MyOtherGui;
That's it. You would then do the same for the other GUIs that would launch in response to the user action.