MATLAB: Execute a function only after GUI closes

getappdatagui

Hello. Upon clicking a button on my main GUI, a second gui will appear with which the user will input the paths of the files to be used and specify some other caracteristics. I am storing this data using setappdata and getappdata. Problem is, the opening of the subgui and the consequent getappdata funtcions are all to be ran upon pressing the same button. When this happens, the program will open the secondary gui but continue running the code without waiting for the user's inputs and the subgui to be closed, whic of course is causing some trouble.
How can I tell Matlab not to go on with the code until the secondary gui is closed?
Thank you

Best Answer

See uiwait() and waitfor()