categorical.lt
categorical: TF = lt (A, B)
Less than for ordinal categorical arrays.
TF = lt (A, B) is the equivalent of the syntax
TF = A < B and returns a logical array of the
same size as the largest input with its elements set to true
where the corresponding elements of A are less than B and
set to false where they are not. A and B must be
size compatible, which translates to they can be the same size, one can
be scalar, or for every dimension, their dimension sizes must be equal or
one of them must be 1.
If categorical arrays A and B are both ordinal, they must have the same set and ordering of categories. Unordered categorical arrays cannot be compared for less than inequality.
One of the input arguments can also be a character vector, a cellstr scalar or a string scalar as long as the other is a categorical array. In this case, a logical array of the same size as the categorical array is returned in which every element is tested for less than inequality by comparing its category with that specified by the string argument.
Undefined elements always return false, since they are not
comparable to any other categorical values including other undefined
elements.
Source Code: categorical
lt (the < operator) ranks values by category order, so it needs an ordinal array. It compares against a category name or another ordinal array.
C = categorical ({'M'; 'S'; 'L'; 'M'}, {'S', 'M', 'L'}, 'Ordinal', true)
C =
4x1 categorical array
M
S
L
M
Which sizes are strictly smaller than L?
C < 'L'
ans = 1 1 0 1
>, <= and >= behave the same way; the same test on a nominal array would raise an error, because unordered categories cannot be ranked.