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

    function obj = setComparisonOperator(obj, comp)
%SETCOMPARISONOPERATOR Set the comparison operator
%
%  OBJ = SETCOMPARISONOPERATOR(OBJ, COMP) sets the comparison operator in
%  OBJ. The comparison operator can be one of {'<=', '==', '>='}.
%
%  See also CGSUMCONSTRAINT/GETCOMPARISONOPERATOR

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


switch comp
    case '<='
        comp = 'le';
    case '>='
        comp = 'ge';
    case '=='
        comp = 'eq';
    otherwise
        comp = 'le';
end

% Convert string to function handle
obj.CompOperator = str2func(comp);