www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@mdevtestplan/updateOutlierIndices.m

    function TP= updateOutlierIndices(TP,NewData,OldData)
%MDEVTESTPLAN/UPDATEOUTLIERINDICES

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

if IsMatched(TP)
    if nargin<2
        NewData= TP.DataLink.info;
    end
    if nargin<3
        % Y data not yet updated
        OldData= getdata(TP,'Y');
    end
    NewGUIDList= getGuids(NewData);
    OldGUIDList= getGuids(OldData);    
    
    if numstages(TP)==1
        % for one-stage models need to update all model nodes below testplan
        ptrs2Update= preorder(TP,@address);
        if length(ptrs2Update)>1
            % remove testplan pointer
            ptrs2Update= [ptrs2Update{2:end}];
        else
            ptrs2Update= null(xregpointer,1,0);
        end
    else
        % two-stage pointes = response + local nodes
        rptrs= children(TP);
        lptrs= pveceval(rptrs,@children);
        lptrs= [lptrs{:}];
        ptrs2Update= [rptrs lptrs];
    end
    
    % get all outlier indices
    outlierInds= pveceval(ptrs2Update,@outliers);
    
    lengthOldGUIDList = length(OldGUIDList);    
    for i=1:length(outlierInds)
        inds = outlierInds{i};
        % Make sure that the current outlier indices are not too large for the 
        % data set we have been given. This could arise when a new dataset is
        % attached to a testplan that was previously matched to a different 
        % dataset.
        if all(inds <= lengthOldGUIDList)
            % find new indices based on guid arrays
            NewInd = NewGUIDList(OldGUIDList(inds));
        else
            % Make sure that no points are marked as outliers.
            NewInd = [];
        end
        % an index of 0 indicates that the guid isn't in the new list
        outlierInds{i} = NewInd(NewInd~=0);
    end
    
    % update outlier indices
    parrayeval(ptrs2Update,@outliers, {outlierInds});
    
    if  numstages(TP)>1 && ~isempty(lptrs) 
        % update pointer indices for new respons features
        pveceval(lptrs, @updateOutlierIndices);
    end
    
end