categorical.ne
categorical: TF = ne (A, B)
Not equal for categorical arrays.
TF = ne (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 and B are not equal and
set to false where they are equal. 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 ordinal, they must have the same set and ordering of categories. If neither are ordinal, the category names of each pair of elements are compared. Hence, they do not need to have the same set of categories.
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 inequality by comparing its category with that specified by the string argument.
Undefined elements always return true, since they are not
comparable to any other categorical values including other undefined
elements.
Source Code: categorical