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

    function obj = setWeightsRange(obj, range)
%SETWEIGHTSRANGE Set the range of the weights variable
%
%  OBJ = SETWEIGHTSRANGE(OBJ, RANGE) sets the range of the weights variable
%  in OBJ. If the weights vector has not been initialised then the weights
%  are created.  The nominal weights value is set to the maximum of the
%  range.
%
%  See also CGSUMCONSTRAINT/GETWEIGHTSRANGE

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


if ~isvalid(obj.Weights)
    obj.Weights = pCreateWeightsPtr(obj);
end
obj.Weights.info = obj.Weights.setrange(range);
obj.Weights.info = obj.Weights.setnomvalue(max(range));

% Need to update the size estimate of a weighted sum term 
obj = updateranges(obj);