www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcmodel/@localresponse/RestoreDataForTest.m

    function L = RestoreDataForTest(L,TestNo, Indices, doUpdate)
%RESTOREDATAFORTEST Restore data previously removed as outliers.
%
%   RESTOREDATAFORTEST( LOCALRESPONSE, TESTNO, INDICES ) restores removed
%   data specified by INDICES in the test specified by TESTNO.
%
%   RESTOREDATAFORTEST( LOCALRESPONSE, TESTNO ) restores all removed data
%   in the test specified by TESTNO.
%
%   RESTOREDATAFORTEST( LOCALRESPONSE, TESTNO, INDICES, DOUPDATE ) restores
%   removed data specified by INDICES in the test specified by TESTNO. If
%   DOUPDATE is true all response feature models will be updated. If a
%   number of tests are being screened it is more efficient to set DOUPDATE
%   to false and call LOCALRESPONSE.UPDATERESPONSEFEATURES when all the
%   tests have been screened.
%
%   Example. For a local response LOCALRESPONSE
%     % remove first two data points and do not update response features
%     RemoveOutliersForTest(LOCALRESPONSE,1,1:2,false);
%     % find list of indices of removed data points
%     indices = OutliersForTest(LOCALRESPONSE,1);
%     % restore first data point
%     RestoreDataForTest(LOCALRESPONSE,1,1,false);
%     % restore all data
%     RestoreDataForTest(LOCALRESPONSE,1,':',false);
%     % update response features
%     UpdateResponseFeatures(LOCALRESPONSE);
%
%   See also mbcmodel.localresponse.UpdateResponseFeatures,
%   mbcmodel.localresponse.RemoveOutliersForTest,
%   mbcmodel.localresponse.OutlierIndicesForTest.

%   Copyright 2006-2010 The MathWorks, Inc.


if nargin<4
    doUpdate = true;
end

if nargin<3
    Indices = ':';
end

if strcmp(Indices,':') || all(ismember(Indices,OutlierIndicesForTest(L,TestNo)))

    % restore data
    L.Object=restoreoutliers(L.Object,TestNo,Indices);

    if doUpdate
        % update response features and other dependents
        L.Object = UpdateLinks(L.Object,3);
    else
        % set status to zero so users don't inadvertently rely on results
        L.Object = ClearLinks(L.Object);
    end
end