www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptim/checkObjectives.m
function [status, msg] = checkObjectives(optim, idx) %CHECKOBJECTIVES Check the status for objectives % % [STATUS, MSG] = CHECKOBJECTIVES(OPTIM) returns a vector of status % codes and a cell array of associated messages, one for each objective % item in the optimization. % % [STATUS, MSG] = CHECKOBJECTIVES(OPTIM, INDEX) returns the status and % messages for the specified objectives. INDEX may be numerical indices % into the objective list or a cell array of labels. % % STATUS is a vector that contains integer codes indicating whether each % item is in an acceptable state. A status of 0 indicates no problem, 1 % indicates a warning issue and 2 indicates an critical problem. MSG is a % cell array of strings that describes the problem and should be non-empty % for items that have a non-zero status. % Copyright 2005-2009 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin<2 idx = 1:length(optim.Objectives); else if ~isnumeric(idx) idx = getObjectiveIndex(optim.OptimSetup, idx); end end [status, msg] = pCheckItems(optim, optim.Objectives(idx), 'Objective','Objectives');