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

    function [lenobj, total] = numObjectives(obj)
%NUMOBJECTIVES Get number of objectives in optimization
%
%  [LENOBJ, TOTAL] = NUMOBJECTIVES returns the lengths of each of the
%  objectives in the optimization and the total number of objective values.
%  LENOBJ is returned as a 1-by-NOBJ vector.

%  Copyright 2005 The MathWorks, Inc.



lenobj = obj.Objectives.OutputLengths;
if nargout>1
    total = sum(lenobj);
end