Next: , Previous: , Up: string   [Contents] string.cmp

Method: [out, outA, outB] = cmp (A, B)

Value ordering comparison, returning -1/0/+1.

Compares each element of A and B, returning for each element i whether A(i) was less than (-1), equal to (0), or greater than (1) the corresponding B(i).

TODO: What to do about missing values? Should missings sort to the end (preserving total ordering over the full domain), or should their comparisons result in a fourth "null"/"undef" return value, probably represented by NaN? FIXME: The current implementation does not handle missings.

Returns a numeric array out of the same size as the scalar expansion of A and B. Each value in it will be -1, 0, or 1.

Also returns scalar-expanded copies of A and B as outA and outB, as a programming convenience.