www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptim/getObjectiveFunc.m
function objective = getObjectiveFunc(optim,objective_name) %GETOBJECTIVEFUNC Get an objective % % GETOBJECTIVEFUNC(OPTIM, LABEL) returns the specified objective. % % GETOBJECTIVE(OPTIM) returns a cell array that contains all of the % objectives. % Copyright 2000-2005 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin>1 ind = getObjectiveIndex(optim.OptimSetup, objective_name); if isempty(ind) error(message('mbc:cgoptim:InvalidLabel2')); else % return the requested constraint objective = optim.Objectives{ind}; end else objective = optim.Objectives; end