www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtools/@cgbrowser/destroyallsubfigures.m
function destroyallsubfigures(h) %DESTROYALLSUBFIGURES Guaranteed closing of all registered figures % % DESTROYALLSUBFIGURES(CGB) closes all of the registered figures. If % the close operation fails to destroy a figure, it is deleted. % Copyright 2000-2013 The MathWorks, Inc. and Ford Global Technologies, Inc. if h.GUIExists SFstruct = h.SubFigures; for n = 1:length(SFstruct.handles) if isgraphics(SFstruct.handles(n)); try % If this fails for any reason it needs to be caught so % delete can be attempted close(SFstruct.handles(n)); end if isgraphics(SFstruct.handles(n)) delete(SFstruct.handles(n)); end end end SFstruct.handles = []; SFstruct.viewlink = []; h.SubFigures = SFstruct; end