| www.delorie.com/gnu/docs/octave/octave_70.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Comparison operators compare numeric values for relationships such as equality. They are written using relational operators.
All of Octave's comparison operators return a value of 1 if the comparison is true, or 0 if it is false. For matrix values, they all work on an element-by-element basis. For example,
[1, 2; 3, 4] == [1, 3; 2, 4]
=> 1 0
0 1
|
If one operand is a scalar and the other is a matrix, the scalar is compared to each element of the matrix in turn, and the result is the same size as the matrix.
x < y
x <= y
x == y
x >= y
x > y
x != y
x ~= y
x <> y
String comparisons may also be performed with the strcmp
function, not with the comparison operators listed above.
See section 5. Strings.
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |