close all hidden problem
Afficher commentaires plus anciens
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 commentaires
Kevin Chng
le 4 Jan 2019
Is there any infinite loop running in your apps?
Yu Li
le 4 Jan 2019
Kevin Chng
le 4 Jan 2019
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
le 4 Jan 2019
Kevin Chng
le 4 Jan 2019
Modifié(e) : Kevin Chng
le 4 Jan 2019
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
le 4 Jan 2019
"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
le 7 Jan 2019
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!