Contents Previous Next Subchapters Current Chapters-> positive negative addition coercion subtraction multiplication division equality ordered logicalOperator matrixMultiplication matrixDivision exponentiation transpose norm stringEquality stringOrdered sequence operationOrder Parent Chapters-> Omatrix6 expression stringOrdered Search Tools-> contents reference index search

Ordered String Comparisons
 Syntax left value` < `right value``` ```left value` > `right value``` ```left value` <= `right value``` ```left value` >= `right value (less than) ``` ```(greater than) ``` ```(less than or equal to) ``` ```(greater than or equal to) See Also element-by-element order and string ==

Description
Tests the row by row ordering of two character matrices. If neither left value nor right value is a row vector, they must have the same row dimension. Ordered comparisons of character matrices return a logical column vector. The i-th element of the return value corresponds to the comparison between the i-th row of the left and right values. ``` ```If the left and right values are character row vectors the first element of the left value that is not equal to the corresponding element of the right value determines the result of the ordered comparison. Trailing spaces in the values are ignored.

Tutorial

Comparing Strings
If you enter ```      x = "abc"      y = "aaz"      print x > y ``` O-Matrix will respond ```      T ``` because the ASCII value of the second element of x is greater than the ASCII value of the second element of y. ``` ```If all of the elements of a string are equal to the corresponding elements of a longer string, the longer string is considered to be "greater." Thus, if you enter ```      x = "abc"      y = "abcd"      print x < y ``` O-Matrix will respond ```      T ``` because y is longer, and thus "greater", than x.

Comparing Matrices
O-Matrix compares each row of two matrices individually, and generates a logical column vector with the same row dimension as the matrices being compared. If you enter ```      v = {"one  ", "one A"}      w = {"one", "one"}      v > w ``` O-Matrix will respond ```      {      F      T      } ``` because the vectors `"one "` and `"one"` are considered equal while the vector `"one A"` is considered greater than the vector `"one"`.

Comparing Matrices With Strings
If one of the values is a row vector, each row of the other value is compared to the row vector. If you enter ```      v = {"one  ", "one A"}      v > "one" ``` O-Matrix will respond ```      {      F      T      } ```