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

    function mdev=restoreoutliers(mdev,SNo,RecInd)
% This function will remove local regression points 
% from the outlier index.
%
% mdev = RESTOREOUTLIERS(mdev_loc,SNo) restores all data in current test
% mdev = RESTOREOUTLIERS(mdev_loc,SNo,RecInd) data specified in RecInd
%
% will restore all points in sweep SNo.
% It works by simply finding the record index
% for any bad data in sweep SNo, and passing that
% index into the ADDOUTLIER routine. This will remove
% any duplicate records from the outlier index.

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


% Get the sweep data
Y=getdata(mdev,'Y');
YData=Y(:,:,SNo);

% find all bad data in that sweep
sweepindex=find(isbad(YData));

if nargin<3 || strcmp(RecInd,':')
    % restore all
    RecInd = sweepindex;
elseif ~all(ismember(RecInd,sweepindex))
    error(message('mbc:mdev_local:InvalidIndices'))
end

% calculates the index wrt all sweeps
Spos=tstart(Y);
RecInd=Spos(SNo) + RecInd-1;

% Find bad data that has been selected with 'rubber box'
RecInd=setdiff(outliers(mdev),RecInd);

% update outlier field in modeldev object
mdev= ApplyOutliers(mdev,SNo,RecInd);