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

    function con = setActiveIndices(con, ai)
%SETACTIVEINDICES Set the indices of the active factors for a constraint
%
%  CON = SETACTIVEINDICES(CON, AI)
%
%  This method does a pure reset of the active indices for a constraint. It
%  performs no checks and does no update of any of the parameters or other
%  information stored in the constraint. ALL sub-classes should overload
%  this method but use this version for the actual seting of the active
%  indices inside the parent CONBASE object.
%
%  If setting new inputs to the constraint, then SETMATCHEDFACTORS may be a
%  more appropriate method to use. 
%
%  See also CONBASE, 
%           CONBASE/GETACTIVEINDICES,
%           CONBASE/GETACTIVEFACTORS,
%           CONBASE/NACTIVEFACTORSALLOWED,
%           CONBASE/SETMATCHEDFACTORS.

%  Copyright 2004-2005 The MathWorks, Inc.

% We want to keep the active factors as a row.
ai = ai(:).';

% Check that the active factors are unique
if length( ai ) ~= length( unique( ai ) ),
    error(message('mbc:conbase:InvalidArgument4'));
end

% Set the active factors
con.ActiveFactors = ai;

%------------------------------------------------------------------------------|
% EOF
%------------------------------------------------------------------------------|