www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptim/setApplicationPointSet.m

    function optim = setApplicationPointSet(optim, itemtype, index, pData,UseMode)
%SETAPPLICATIONPOINTSET Set an application point set for an item.
%
%   OPTIM = SETAPPLICATIONPOINTSET(OPTIM, ITEMTYPE, INDEX, PDATA,USEMODE) sets
%   PDATA as the data set to use for an application point set for the item
%   specified by ITEMTYPE and INDEX.  ITEMTYPE must be one of 'objective'
%   or 'constraint' and INDEX is the scalar index into the list of
%   objectives or constraints. USEMODE specifies whether to interpolate by
%   mode.

%   Copyright 2009 The MathWorks, Inc.

DS = optim.oppoints;
if ~isnull(pData) && ~any(pData==DS.Datasets)
    % Have to add oppoint to optimization as the setup info must also be
    % increased
    optim = addOppoint(optim,pData.getname,pData);
    DS = optim.oppoints;
end
switch itemtype
    case 'constraint'
        DS = editConstraint(DS,index,pData);
    case 'objective'
        DS = editObjective(DS,index,pData);
end

if nargin>4
   DSindex = DS.Datasets==pData;
   DS = editUseMode(DS,DSindex,UseMode);
end

optim.oppoints = DS;
optim = cleanupOppoints(optim);