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!