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

    function mdev= RestoreData(mdev,OutlierIndices)
%RESTOREDATA Restore data previously removed as outliers
%
%   RESTOREDATA( RESPONSE, OutlierIndices ) restores all removed data
%   specified in OutlierIndices
%   RESTOREDATA( RESPONSE ) restores all removed data
%

%  Copyright 2006 The MathWorks, Inc. and Ford Global Technologies, Inc.

if nargin<2
    OutlierIndices = ':';
end


Yall = getdata(mdev);
Nrec= size(Yall,1);
NewOutliers = [];

if islogical(OutlierIndices)
    OutlierIndices= find(OutlierIndices);
end
  
if ~isempty(OutlierIndices)
    % outlier indices specified
    
    if min(OutlierIndices)<1 || max(OutlierIndices)>Nrec;
        error(message('mbc:modeldev:InvalidIndex'))
    end
    NewOutliers = OutlierIndices(:);   
elseif strcmp(OutlierIndices,':')
    % restore all outliers
    NewOutliers = outliers(mdev);
end

if ~isempty(NewOutliers)
    NewOutliers= setdiff(outliers(mdev), NewOutliers);
    % set outliers
    preorder(mdev,@outliers,NewOutliers);
    % refit all models
    preorder(info(mdev),@refit);
end
mdev= info(mdev);