www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptimoptions/removeConstraint.m
function obj = removeConstraint(obj, sLabel) %REMOVECONSTRAINT Remove a constraint from the optimization. % OPTIONS = REMOVECONSTRAINT(OPTIONS, LABEL) removes the placeholder % for the constraint referred to by the string LABEL. % % See also CGOPTIMOPTIONS/GETMODELCONSTRAINTS, % CGOPTIMOPTIONS/GETLINEARCONSTRAINTS, % CGOPTIMOPTIONS/ADDMODELCONSTRAINT, % CGOPTIMOPTIONS/ADDLINEARCONSTRAINT. % Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc. if ~ischar(sLabel) error(message('mbc:cgoptimoptions:InvalidArgument14')); end varIndex = strcmp(sLabel, {obj.constraints.details.label}); if ~any(varIndex) warning(message('mbc:cgoptimoptions:InvalidLabel', sLabel)); else obj.constraints.details = obj.constraints.details(~varIndex); end