www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@contable1/setRelation.m

    function con = setRelation(con, op)
%SETRELATION Set the relational operators (<= or >=) for a table
%
%  CON = SETRELATION(CON, OP)
%  CON = SETRELATION(CON, '<=') 
%  CON = SETRELATION(CON, '>=') 
%
%  See also CONTABLE1, CONTABLE1/GETRELATION.

%  For compatibility, there are the following forms are supported:
%    CON = SETRELATION(CON, 1) % "less than" tables
%    CON = SETRELATION(CON, 0) % "greater than" tables

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

if ischar( op ),
    switch op,
        case {'<=', '=<'}, % less than
            con.le = 1;
        case {'>=', '=>'}, % greater than
            con.le = 0;
        otherwise
            error(message('mbc:contable1:InvalidArgument2', op));
    end
elseif isnumeric( op ) && any( op == [0, 1] ),
    % Need to store a double because we will pass to a MEX function
    con.le = double( op );
else
    error(message('mbc:contable1:InvalidArgument3'));
end

%------------------------------------------------------------------------------|
% EOF
%------------------------------------------------------------------------------|