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

    function obj = setLowerValueMode(obj, mode)
%SETLOWERVALUEMODE Set the current evaluation mode of the lower bound
%
%   OBJ = SETLOWERVALUEMODE(OBJ, MODE) sets the current right-hand side
%   mode of the lower bound constraint. 
%   If MODE = 'value' or MODE = 0, a constant will be used as the
%   constraint comparison.  
%   If MODE = 'internal' or MODE = 1, the internal lower bound vector will
%   be evaluated for the constraint comparison value.
%   If MODE = 'input' or MODE = 2, the second expression input will be
%   evaluated for the constraint comparison value.
%
%   See also CGRANGECONSTRAINT/SETLOWERRHSVALUE,
%   CGRANGECONSTRAINT/SETLOWEREVALUATIONMODE

%   Copyright 2006 The MathWorks, Inc.

% Set the mode of the lower bound expression
modeForExprCon = pInternalToExprCon(mode);
obj.LowerBound.info = setvaluemode(obj.LowerBound.info, modeForExprCon);

% If internal vector specified, then set the lower expression to be the
% internal pointer
if mode == 1
    obj.LowerBound.info = setrhsexpr(obj.LowerBound.info, obj.pMinVector);
    % Expr constraints support the evaluation of a boundary constraint of a
    % variable. Disallow for range constraints.
    obj.LowerBound.info = setevaluationmode(obj.LowerBound.info, [], 0);
end

% If external expression specified and current expression is the internal
% vector, then set the lower bound expression to be null
pExpr = getrhsexpr(obj.LowerBound.info);
if mode == 2 && pExpr == obj.pMinVector
    obj.LowerBound.info = setrhsexpr(obj.LowerBound.info, mbcpointer(1));
end