How to close mutiple uifigure using command
조회 수: 264 (최근 30일)
이전 댓글 표시
I run fig = uifigure many time in Matlab,so I genetared lots of uifigure ,I want to close all uifigure with one line of command.Do you know what command I should enter in Matlab.Thank you very much
댓글 수: 0
채택된 답변
Ameer Hamza
2020년 10월 14일
Run this
all_fig = findall(0, 'type', 'figure');
close(all_fig)
댓글 수: 6
Yang Liu
2023년 11월 10일
Thank you, but don't take my wife. Your codes works for me, just a quick question:
What does the 0 represent? I try to figure out with help findall, and find nothing helpful...
Thanks, and take my wife now.
Voss
2024년 4월 4일 4:47
0 is the graphics root object, which is also returned by the groot function, so you could do findall(groot,_)
추가 답변 (2개)
Bjorn Gustavsson
2020년 10월 14일
If you want to keep some figures you can close a subset of them if you keep the figure-handles in an array. If you modify your creation to something like this for all call to uifigure:
if ~exist('uifig')
uifig = uifigure;
else
uifig(end+1) = uifigure;
end
if ~exist('uifig')
uifig = uifigure;
else
uifig(end+1) = uifigure;
end
% ...etc
% then you can close some suitable set of them, or all of them
% closing all:
close([uifig]),clear uifig
% closing some:
close([uifig([1 3])]),uifig([1 3]) = [];
HTH
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop uifigure-Based Apps에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!