www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptim/setOppointPtr.m
function optim = setOppointPtr(optim, label, pDS) %SETCONSTRAINT Update an existing constraint % % OPTIM = SETCONSTRAINT(OPTIM, LABEL, P_DS) updates the specified % dataset to use the given new oppoint object. % % OPTIM = SETCONSTRAINT(OPTIM, P_DS) sets a new pointer vector of all % the datasets. The length of P_DS must match the current number % of datasets in the optimization. % Copyright 2005-2009 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin==3 ind = getOperatingPointSetIndex(optim.OptimSetup, label); if ind==0 error(message('mbc:cgoptim:InvalidLabel8')); else % set the objective optim.oppoints = editDataset(optim.oppoints,ind,pDS); end else if numel(label)~=numel(optim.oppoints.Datasets) error(message('mbc:cgoptim:InvalidArgument22')); end for i=1:length(label) optim.oppoints = editDataset(optim.oppoints,i,label(i)); end end