MATLAB: Close one GUI after another is opened

gui

So I have a GUI game with an home screen that has a play button. Once I run my game gui, the home screen stays open and I want it to close. I've tried using "close homescreengui.m" but it doesn't work
function game_play_button_Callback(hObject, eventdata, handles)
run GameGUI.m
%%%%close homescreen after gamegui runs

Best Answer

Delete the handle to your GUI you want to shutdown
delete(handles.homescreengui);
Here, homescreengui would be the "tag" property of your main figure. Double-click on the "background" or empty area of your GUI to see the tag property in the property inspector. Whatever the tag is, delete it with the delete() function when you want to shutdown that GUI.
Related Question