function RespObj = deletesys(RespObj,indDelete);
%DELETESYS Remove systems from the Response Objects

%   Authors: Karen D. Gondoly: 4-6-98
%   Revised: Adam W. DiVergilio
%   Copyright 1986-2000 The MathWorks, Inc. 
%   $Revision: 1.8 $  $Date: 2000/06/14 20:07:28 $

%---Remove all occurrences of the deleted systems
RespObj.SystemNames(indDelete) = [];
RespObj.SelectedModels(indDelete) = [];
RespObj.SystemVisibility(indDelete) = [];

%---Delete corresponding response handles and menu items
for ctD=1:length(indDelete)
   RH = RespObj.ResponseHandles{indDelete(ctD)};
   RH = cat(1,RH{:});
   RH = cat(1,RH{:});
   RH = RH(ishandle(RH));
   set(RH,'DeleteFcn','');
   delete(RH);
end

delete(RespObj.UIContextMenu.Systems.Names(indDelete))

% Update RespObj UIContextMenu and ResponseHandles array
RespObj.UIContextMenu.Systems.Names(indDelete)=[];
RespObj.ResponseHandles(indDelete) = [];
