does anyone know how to close a specified figure if it exists currently? for example: h=figure
if h exists close(h) end

 채택된 답변

Grzegorz Knor
Grzegorz Knor 2011년 9월 6일

3 개 추천

h = figure;
if ishandle(h)
close(h)
end

댓글 수: 4

Grzegorz Knor
Grzegorz Knor 2011년 9월 6일
ishandle(h) returns 1 if figure exists and 0 if figure is close.
mohammad
mohammad 2011년 9월 6일
thanks a lot
how can do when i know name of the figure
for example:
h=figure(.........
'Name','flashing', ...)
figure name is:flashing
if 'flashing' exist
close flashing
end
Grzegorz Knor
Grzegorz Knor 2011년 9월 6일
close(findobj('type','figure','name','flashing'))
mohammad
mohammad 2011년 9월 6일
thanks a lot

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

추가 답변 (2개)

Paulo Silva
Paulo Silva 2011년 9월 6일

3 개 추천

close(findall(0,'type','figure','name','flashing'))
Zoltan Gal
Zoltan Gal 2019년 4월 13일

0 개 추천

If the index of figure is 5, then
close(findobj('type','figure','number',5))

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

질문:

2011년 9월 6일

답변:

2019년 4월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by