Method Reference: string.issortedrows

string: TF = issortedrows (str)
string: TF = issortedrows (str, col)
string: TF = issortedrows (str, direction)
string: TF = issortedrows (str, col, direction)
string: TF = issortedrows (…, 'MissingPlacement', MP)

Return true if string matrix rows are sorted.

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

TF = issortedrows (str, col) returns a logical scalar TF, which is true, if the string array str 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 str. Positive elements sort the corresponding columns in ascending order, while negative elements sort the corresponding columns in descending order.

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

  • 'ascend', which is the default, checks if 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 missing elements.
  • 'strictdescend' checks if elements are in descending order and there are no duplicate or missing elements.
  • 'strictmonotonic' checks if elements are either in ascending or descending order and there are no duplicate or missing elements.

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

TF = issortedrows (str, col, direction) checks if the rows in the string array str 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 str.

TF = issortedrows (…, 'MissingPlacement', MP) specifies where missing elements (<missing>) 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: string