www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@xregtools/@MBrowser/destroyallsubfigures.m
function destroyallsubfigures(h) %DESTROYALLSUBFIGURES Guaranteed closing of all registered figures % % h.destroyallsubfigures % % Copyright 2000-2013 The MathWorks, Inc. and Ford Global Technologies, Inc. if h.GUIExists fighndls=h.SubFigures; for n=1:length(fighndls) if isgraphics(fighndls(n)) if strcmp(get(fighndls(n),'Visible'),'on') % only call close if the figure is visible try % if this fails for any reason it needs to be caught so % delete can be attempted close(fighndls(n)); end end if isgraphics(fighndls(n)) delete(fighndls(n)); end end end h.SubFigures=[]; end