deployed app exit when GUI appeared
1 view (last 30 days)
I have a function that shows a GUI with buttons and callbacks.
When running in matlab, it create the gui figure and release the command window, but callback still works when I click on GUI.
However, when I compiled it into exe, the GUI appears and immediately go sway and program exited.
Is there a way to hold the gui?
Walter Roberson on 27 Dec 2020
Your flow of control does not waitfor() or uiwait() after creating the graphics, so you get to the bottom of the initialization loop and exit the program.
When you do not compile, then the graphics objects all keep existing because you have the keyboard to go back to for more interaction.
If you are using GUIDE, then look in the code generated for the GUI OpenFcn callback, and you will see a commented-out call to wait for the graphics window to close. Remove the comment marker so that wait becomes active.