www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@conbase/useAllInputFactors.m

    function con = useAllInputFactors(con)
%USEALLINPUTFACTORS Make as many inputs active as possible
%
%  CON = USEALLINPUTFACTORS(CON) makes any non-active input factors active,
%  up to the limit imposed by NACTIVEFACTORSALLOWED.
%
%  See also CONBASE/SETACTIVEINDICES.

%  Copyright 2005 The MathWorks, Inc.


nF = nFactors(con);
activeInd = getActiveIndices(con);
activeLims = nActiveFactorsAllowed(con);
realLim = min(nF, activeLims(2));
if length(activeInd)<realLim
    % We can add more factors
    availInd = setdiff(1:nF, activeInd);
    newActiveInd = [activeInd, availInd(1:(realLim-length(activeInd)))];
    con = setActiveIndices(con, newActiveInd);
end