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

    function branch = setInputFactors(branch, cif)
%SETINPUTFACTORS Set the input factors in a boundary branch
%
%  BROOT = SETINPUTFACTORS(BRANCH, CIF) updates all of the constraints in
%  the boundary tree from BRANCH down with the new input factors, CIF.
%
%  See also XREGBDRYBRANCH, CONINPUTFACTOR, XREGBDRYBRANCH/GETINPUTFACTORS

%  Copyright 2006 The MathWorks, Inc.

% Reduce the input factors down to just those required for this branch
% -- response local level require all factors to update the constraint
% while global level require just global factors. Note that
% pFilterFactorsForStages will return only the local input factors if we
% call it with "1" (local) as the stages argument.
pRoot = Parent( branch );
switch branch.Stages,
    case {0, 1}, % response or local
        cif = pRoot.pFilterFactorsForStages( cif, 0 );
    case 2, % global
        cif = pRoot.pFilterFactorsForStages( cif, 2 );
    otherwise
        error(message('mbc:xregbdrybranch:InvalidState'));
end

% Update children with new factor info
children( branch, @setInputFactors, cif );