www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/+mbcmodelview/@OutlierLine/remove.m

    function remove(obj, hnds)
%REMOVE Remove line handles from outlierline management
%
% REMOVE(OL, HNDS)
% check HNDS are current line handles of OL, delete their outlier lines
% and remove the line handles from the OL userdata
% 
% called by listener to ObjectBeingDestroyed of line on line/axes/figure delete
% NOTE: all lines can be removed, the outlierindices persist

%  Copyright 2000-2015 The MathWorks, Inc. and Ford Global Technologies, Inc.


% check they are linehandles (if called from command line)
hnds = isLineHandle(obj, hnds);
% check they are current OL line handles
ind = ismember(obj.lineHandles, hnds);

if any(ind)
	set(hnds,'ButtonDownFcn','');

	% delete the outlierlines if they still exist
	% figure delete may already have wiped them out
	ws = warning('off','all');
	delete(isLineHandle(obj, obj.OutlierLines(ind)));
	warning(ws);

	% remove line handles etc from ud
	obj.LineParents = obj.lineParents(~ind);
	obj.LineHandles = obj.lineHandles(~ind);
	obj.OutlierLines = obj.outlierLines(~ind);
	
    obj.L_LineDestroyed(ind)= [];
    obj.L_DataChanging(:,ind)= [];
end
% if no lines left attached, set datasize to zero 
% hence new lines of any datalength can  be added
if isempty(obj.LineHandles)
	obj.DataSize = 0;
end