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

    function clocal = localconstraints(c,opts,nLocal)
%LOCALCONSTRAINTS convert options structure to constraint objects
%
% clocal = localconstraints(c,opts,nLocal)

%  Copyright 2007 The MathWorks, Inc.

cif = getInputFactors(c);
cif = cif(1:nLocal);

clocal = cell(size(opts));
for i=1:length(clocal)
    % build local constraint types
    if ischar(opts(i).ConType)
        opts(i).ConType = str2func(['con',opts(i).ConType]);
    end
    % constructor call
    clocal{i} = opts(i).ConType(cif);
    if isfield(opts,'ActiveFactors') && ~isempty( opts(i).ActiveFactors )
        % active factors
         clocal{i} = setActiveIndices( clocal{i},opts(i).ActiveFactors);
    end
end