www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptimextoptions/fixForModes.m
function obj = fixForModes(obj) %FIXFORMODES Make sure object satisfies its items' mode requirements % % OBJ = FIXFORMODES(OBJ) checks that the options object has the number of % items that the mode for each item requires. Any excess items are % removed and any extra required ones are added. % Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc. % The only possibility is that there are not enough variables or objectives [num, mn, mx] = numVariables(obj); while num<mn obj = addFreeVariable(obj, generateLabel(obj, 'FreeVariable')); num = numVariables(obj); end [num, mn, mx] = numObjectives(obj); while num<mn obj = addObjective(obj, generateLabel(obj, 'Objective'), 'min/max'); num = numObjectives(obj); end