필터 지우기
필터 지우기

Closing all figures except 2

조회 수: 33 (최근 30일)
Jason
Jason 2018년 3월 21일
댓글: Jason 2018년 3월 21일
I have a function that closes all figures except my main figure (GUI1)
% Close figures
fig1h = findall(0,'type','figure','Tag','GUI1'); %Keep this open as its the main GUI figure
figh = findall(0,'type','figure');
other_figures = setdiff(figh, fig1h)
delete(other_figures)
I wanted to modify this to also keep open a 2nd GUI whos tag is "LTF" but its not keeping open this 2nd GUI figure.
% Close figures
fig1h = findall(0,'type','figure','Tag','GUI1'); %Keep this open as its the main GUI figure
figh = findall(0,'type','figure');
figl=findall(0,'type','figure','Tag','LTF');
other_figures = setdiff(figh, fig1h)
other_figures = setdiff(other_figures, figl)
delete(other_figures)
  댓글 수: 2
dpb
dpb 2018년 3월 21일
We can't duplicate your GUI; set a breakpoint in the routine and step through to see what is going on internally. Superficially, other than some inefficiencies in duplicated code where could use compound search don't see anything obvious.
Jason
Jason 2018년 3월 21일
ha ha ... it does work, I had changed the "name" of the figure and not the "Tag".

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by