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

    function mdev = ClearLinks(mdev)
%CLEARLINKS clear status of all linked fits
%    mdev = ClearLinks(mdev);
%    Linked fits include all response features and all responses with
%    linked datums

%  Copyright 2009-2010 The MathWorks, Inc. and Ford Global Technologies, Inc.

% clear status of all local + response feature nodes
preorder(mdev,@clearModel);
mdev = info(mdev);
if childindex( info(Parent(mdev)) ) == 1
    % responses with linked datums
    T= mdevtestplan(mdev);
    prf= children(T);
    for i=2:length(prf)
        m= prf(i).model;
        dtype= get(m,'datumtype');
        if dtype==3
            % clear status of all linked nodes 
            
            preorder(prf(i).info,@clearModel);
            
            mdevLocal = infoarray(children(prf(i).info));
            for j=1:length(mdevLocal)
                % set local fits to unfitted
                s= statistics(mdevLocal{j});
                % set local RMSE to NaN
                s(1) = NaN;
                mdevLocal{j} = statistics(mdevLocal{j},s);
                mdevLocal{j} = BestModel(mdevLocal{j},0);
                mdevLocal{j}.FitOK(:)=false;
                xregpointer(mdevLocal{j});
            end
        end
    end
end


function mdev=clearModel(mdev)

% set status to 0 to indicate unfitted
mdev = status(mdev,0,0);
if ~strcmp(guid(mdev),'local')
    % set stats to NaN except for local  
    s=statistics(mdev);
    s(:)=NaN;
    mdev = statistics(mdev,s);
end