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

    function obj = setUpperExpression(obj, p)
%SETUPPEREXPRESSION Set the expression for the upper bound
%
%   OBJ = SETUPPEREXPRESSION(OBJ, P) sets the expression for the upper
%   bound constraint to be P.
%
%   OBJ = SETUPPEREXPRESSION(OBJ, 'vector') sets the expression for the
%   lower bound constraint to be the internal pointer, OBJ.PMAXVECTOR
%
%   See also CGRANGECONSTRAINT/SETLOWEREXPRESSION

%   Copyright 2006-2007 The MathWorks, Inc.

if isempty(p)
    % If an empty mbcpointer is specified, then pass a 1-by-1 null to
    % cgexprconstraint to avoid error
    p = mbcpointer(1);
end

[unused, upperCode] = getUpperValueMode(obj);
if upperCode ~= 1
    % Set the upper expression
    obj.UpperBound.info = setrhsexpr(obj.UpperBound.info, p);
end