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

    function branch = pUpgradeConstraint(branch, friend)
%PUPGRADECONSTRAINT Upgrade the constraints for the children of a branch
%
%  BRANCH = PUPGRADECONSTRAINT(BRANCH, FRIEND)
%
%  See also XREGBDRYBRANCH, XREGBDRYDEV/LOADOBJ.

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

% If this branch is for the global level cosntraint then the we need to
% extract the global model from the friend. Note that a "local" constraint
% is in fat a two-stage constraint and therefore needs local & global
% inputs.
if branch.Stages == 2,
    if isa(friend,'xregtwostage')
        friend = get( friend, 'Global' );
        if iscell( friend ),
            friend = friend{1};
        end
    else
        cif = getInputFactors(branch, 2);
        friend = makeXregmodel(cif,@xregcubic);
    end

end

% Upgrade the constraint held by the children
children( branch, @pUpgradeConstraint, friend );

%--------------------------------------------------------------------------
% EOF
%--------------------------------------------------------------------------