www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptimstore/getNumConstraint.m

    function ncon = getNumConstraint(optimstore, varargin)
%GETNUMCONSTRAINT Return the number of constraints per label
%
%   NCON = GETNUMCONSTRAINT(OPTIMSTORE) returns the number of constraints
%   that will be returned from an evaluation of each labelled constraint.
%   For example, consider an optimization that has a sum constraint over a
%   set of points, S, and a point constraint to be evaluated at each member
%   of S. NCON will return [1 r], where r is the number of points in S.
%
%   NCON = GETNUMCONSTRAINT(OPTIMSTORE, CONLABELS) returns the number of
%   constraints from an evaluation of the defined constraints.
%
%   See also CGOPTIMSTORE/GETNUMNONLCON

%   Copyright 2006 The MathWorks, Inc.

ncon = getNumCon(optimstore.OptimRunner);
if nargin > 1
    indx = pGetItemIndex(optimstore, varargin{1}, 'constraint');
    ncon = ncon(indx);
end