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

    function cif = pFilterFactorsForStages(broot, cif, stages)
%PFILTERFACTORSFORSTAGES Filter input factors to stages
%
%  CIF = PFILTERFACTORSFORSTAGES(BROOT, CIF, STAGES)
%  CIF = PFILTERFACTORSFORSTAGES(BROOT, CIF, 0) response level input factors, i.e., all
%  CIF = PFILTERFACTORSFORSTAGES(BROOT, CIF, 1) local level input factors
%  CIF = PFILTERFACTORSFORSTAGES(BROOT, CIF, 2) global level input factors
%  CIF = PFILTERFACTORSFORSTAGES(BROOT, CIF) uses STAGES = 0
%
%  See also XREGBDRYROOT XREGBDRYROOT/GETINPUTFACTORS, CONINPUTFACTOR.

%  Copyright 2006-2012 The MathWorks, Inc. and Ford Global Technologies, Inc.

if nargin < 3,
    stages = 0;
end

% We need to know the number of local factors
nlf = numLocalFactors(broot);

% -- The first nlf input factors are the local ones. The others are the
%    global ones.
switch stages,
    case 0, % response
        % return them all
    case 1, % local
        cif = cif(1:nlf);
    case 2, % global
        cif = cif(nlf+1:end);
    otherwise
        error(message('mbc:xregbdryroot:InvalidArgument1'));
end

function nlf = numLocalFactors(broot)
% we just look ask for the 1st test since we only want to know the number of local factors
ss = getdata( broot, 'stage', 'Local', 'testId', 1);
nlf = size( ss, 2 );