function close(ViewerObj)
%CLOSE  Close LTI Viewer

%   Author(s): A. DiVergilio
%   Copyright 1986-2000 The MathWorks, Inc. 
%   $Revision: 1.3 $  $Date: 2000/06/14 20:03:09 $

%---See if associated windows are open
PP = get(ViewerObj.FigureMenu.EditMenu.LineStyles,'UserData');
if PP & ishandle(PP), close(PP), end

%---Close any open I/O and Array Selectors
UIC = ViewerObj.UIContextMenu;
AllUImenus = get(UIC,{'children'});
AllUImenus = cat(1,AllUImenus{:});
MenusWithChildren = [findobj(AllUImenus,'Tag','IOSelector'); ...
      findobj(AllUImenus,'Tag','ArraySelector')];
Selectors = get(MenusWithChildren,{'UserData'});
Selectors = cat(1,Selectors{:});
delete(Selectors(ishandle(Selectors)));

set(ViewerObj.Handle,'DeleteFcn','');
delete(ViewerObj.Handle);
