www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgsumconstraint/private/pCreateWeightsPtr.m

    function pWeights = pCreateWeightsPtr(obj)
%PCREATEWEIGHTSPTR Create a pointer to the weights variable
%
%  PWEIGHTS = PCREATEWEIGHTSPTR(OBJ) creates a pointer to a cgvariable to
%  handle the weights input to the sum objective. This pointer is held
%  internally in this object and is destroyed when the object is deleted.

%  Copyright 2005 The MathWorks, Inc. and Ford Global Technologies, Inc.


nm = getName(obj);
wvar = cgvalue;
wvar = setname(wvar, [nm '_weights']);
wvar = setrange(wvar, [0 1]);
wvar = setnomvalue(wvar, 1);
pWeights = xregpointer(wvar);