deployed app exit when GUI appeared
1 次查看(过去 30 天)
显示 更早的评论
Hi,
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?
Thanks.
0 个评论
采纳的回答
Walter Roberson
2020-12-27
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!