Why does my MATLAB application closes unexpectedly when no figure is open?
6 views (last 30 days)
Show older comments
MathWorks Support Team
on 1 Mar 2017
Answered: MathWorks Support Team
on 1 Mar 2017
I have written an application consisting of several users interfaces. When one user interface/figure is closed, the visibility of a different figure is set from off to on. This works fine in MATLAB. However in a standalone application the new figure is not shown, the application closes. When opening the application from cmd.exe I see the following message:
Warning: 1 invisible figure(s) exist at MATLAB Runtime termination. The figure ID's of the remaining figures are:
If your application has terminated unexpectedly, please note that applications generated by the MATLAB Compiler terminate when there are no visible figure windows.
See documentation on how Standalone applications terminate for more information.
Accepted Answer
MathWorks Support Team
on 1 Mar 2017
A standalone application ends when the end of the main function is reached or when there is no visible figure anymore. Since you close a figure before making the next figure visible, the standalone application ends. This behavior is intended. There are two ways you can ensure that the next GUI/figure is shown:
- Have some code running that runs till the next figure is set to visible
- Set the new figure to visible just before/while the original figure is closed
0 Comments
More Answers (0)
See Also
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!