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

    function nobj = getNumObjectives(optimstore, varargin)
%GETNUMOBJECTIVES Return the number of objectives per label
%   NOBJ = GETNUMOBJECTIVES(OPTIMSTORE) returns the number of objectives
%   that will be returned from an evaluation of each objective label.
%   For example, consider an optimization that has a sum objective over
%   a set of points, S, and a point objective to be evaluated at each
%   member of S. NOBJ will return [1 r], where r is the number of points in
%   S. 
%
%   See also: CGOPTIMSTORE/GETOBJECTIVES, CGOPTIMSTORE/GETOBJECTIVETYPE.

%  Copyright 2005 The MathWorks, Inc. and Ford Global Technologies, Inc.


if nargin > 1
    indx = pGetItemIndex(optimstore, varargin{1}, 'objective');
else
    indx = 1:getNumObjectiveLabels(optimstore);
end

nobj = numObjectives(optimstore.OptimRunner);
nobj = nobj(indx);