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

    function [lencon, total] = numConstraints(obj)
%NUMCONSTRAINTS Get number of constraints in optimization
%
%  [LENCON, TOTAL] = NUMCONSTRAINTS returns the lengths of each of the
%  constraints in the optimization and the total number of constraint
%  values. LENCON is returned as a 1-by-NCON vector.

%  Copyright 2005 The MathWorks, Inc.


lencon = obj.Constraints.OutputLengths;
if nargout>1
    total = sum(lencon);
end