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

    function OK= UpdateModel(MD,KeepOutliers,UnChangedTests)
%UPDATEMODEL update model fit for new data
%
% OK= UpdateModel(MD,KeepOutliers,UnChangedTests)


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

OK=1;
if nargin==1
    KeepOutliers=0;
end


if isa(MD.Model,'xregtwostage')
    % Do Nothing - fit only required for globals and datum
    % not the twostage itself.
else   % (one-stage resp, resp feat, global, datum)
    try
        p= Parent(MD);
        if MD.Status==2 && strcmp(p.class,'modeldev')
            % copy model from parent and save a refit
            MD.Model = p.model;
            MD.Statistics = p.statistics;
            if p.status==0
                MD= status(MD,p.status,0);
            end
            xregpointer(MD);
        else
            if ~KeepOutliers
                MD.Outliers=[];
            end
            % do a full refit on model
            MD= refit(MD);
            % don't keep internal stores
            MD= cleanup(MD);
        end
    catch
        OK=0;
    end
end