www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cgexprconstraint/setevaluationmode.m

    function obj = setevaluationmode(obj, LMode, RMode)
%SETEVALUATIONMODE Set the current input evaluation settings
%
%  OBJ = SETEVALUATIONMODE(OBJ, LMODE, RMODE) sets the evaluation functions
%  to apply to the inputs for the left- (LMODE) and right- (RMODE) hand
%  sides of the constraint.  Each mode input must be one of the strings
%  'eval', 'constraint', 'pev' or one of the integer codes 0,1,2 which
%  correspond to each of these settings.  If either of the modes is an
%  empty or if RMODE is omitted then that input's setting is not changed.

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


if nargin>1 && ~isempty(LMode)
    if ischar(LMode)
        obj.ExprEvalFunc = find( strncmpi( LMode,{ 'eval', 'constraint', 'pev' },length(LMode) ) )-1;
    else
        obj.ExprEvalFunc = LMode;
    end
end

if nargin>2 && ~isempty(RMode)
    if ischar(RMode)
        obj.CompEvalFunc = find( strncmpi( RMode,{ 'eval', 'constraint', 'pev' },length(RMode) ) )-1;
    else
        obj.CompEvalFunc = RMode;
    end
end