I am currently creating a program for a class project and am having trouble using the uicontrol. For this part of the project, I am using while loops to change between scripts based on what value is assigned to the variable exe. I first set exe=1 and then run the while loop; while exe==1. Inside the while loop, I want the script to create a figure with a push button. What I want is for the script to wait for the button to be pressed, and then once it is pressed, I want the window to close, and to set exe=2 so that the next part of the script will run.
Here is what I have for a script. The while loops work, but the script doesn't like the callback.
main_menu=uicontrol('Style','pushbutton','Position',[20 20 20 20],'String','Pong','Callback',@exe1);
The result is the figure popping up with the push button along with the error;
Undefined variable "handles" or class "handles.main_menu".
When I push the button is returns another error;
Undefined function 'exe1' for input arguments of type 'matlab.ui.control.UIControl'.
Error while evaluating UIControl Callback.