categorical

Methods

Method Reference: categorical.issortedrows

categorical: TF = issortedrows (C)
categorical: TF = issortedrows (C, col)
categorical: TF = issortedrows (C, direction)
categorical: TF = issortedrows (C, col, direction)
categorical: TF = issortedrows (…, 'MissingPlacement', MP)

Return true if categorical matrix rows are sorted.

TF = issortedrows (C) returns a logical scalar TF, which is true, if the rows in the 2-D categorical array C are sorted in ascending order, and false otherwise.

TF = issortedrows (C, col) returns a logical scalar TF, which is true, if the categorical array C is sorted according to the columns specified by the vector col, and false otherwise. col must explicitly contain non-zero integers whose absolute values index existing columns in C. Positive elements sort the corresponding columns in ascending order, while negative elements sort the corresponding columns in descending order.

TF = issortedrows (C, direction) checks if the rows in C are sorted according to the specified direction, which can be one of the following options:

  • 'ascend', which is the default, checks is elements are in ascending order.
  • 'descend' checks if elements are in descending order.
  • 'monotonic' checks if elements are either in ascending or descending order.
  • 'strictascend' checks if elements are in ascending order and there are no duplicate or undefined elements.
  • 'strictdescend' checks if elements are in descending order and there are no duplicate or undefined elements.
  • 'strictmonotonic' checks if elements are either in ascending or descending order and there are no duplicate or undefined elements.

Alternatively, direction can be a cell array of character vectors specifying the sorting direction for each individual column of C, in which case the number of elements in direction must equal the number of columns in C.

TF = issortedrows (C, col, direction) checks if the rows in the categorical array C are sorted according to the columns specified in col using the corresponding sorting direction specified in direction. In this case, the sign of the values in col is ignored. col and direction must have the same length, but not necessarily the same number of elements as the columns in C.

TF = issortedrows (…, 'MissingPlacement', MP) specifies where missing elements (<undefined>) are placed with one of the following options specified in MP:

  • 'auto', which is the default, places missing elements last for ascending sort and first for descending sort.
  • 'first' places missing elements first.
  • 'last' places missing elements last.

Source Code: categorical