close all hidden problem
显示 更早的评论
I want to close the invisible figure in an app, but after I use command: close all hidden, the apps are becomes 'invalid or deleted objects'
close all hidden will only close figures including invisible figures, not apps. so...is there any mistake with my operation?
Thanks!
Yu
8 个评论
Kevin Chng
2019-1-4
Is there any infinite loop running in your apps?
Yu Li
2019-1-4
Kevin Chng
2019-1-4
or try to delete the specific hidden figure in this way:
close(h)
name the figure as h, let see will it working fine or not.
Yu Li
2019-1-4
Kevin Chng
2019-1-4
编辑:Kevin Chng
2019-1-4
Try
figHandles = get(groot, 'Children');
for i=1:1:length(figHandles)
close(figHandles(i));
end
If error is persistent, i believe there is something still running with the figures.
Yu Li
2019-1-4
"but according to this page: https://www.mathworks.com/help/matlab/ref/close.html close all hidden will only close figures including invisible figures, not apps"
I searched that page for the word "app" and it only occurs once in a link below the help itself. Why do you think that close does not apply to apps? I don't see that written anywhere on that page.
In any case, writing close all is a sledgehammer approach to writing code. While it might be fun and useful from the command line, coding something like that into any app, GUI, or function is like shooting yourself in the knee. Instead of writing such brutal, uncontrolled code, learn how to obtain and use explicit handles for all graphics objects that you use:
Once you learn to use graphics object handles then your code will be much more robust, reliable, and easier to debug.
Yu Li
2019-1-7
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!