Sort rowsπŸ”—

Sorts matrices and tables according to a key.

InputsπŸ”—

  • inputX: A matrix or table to be sorted. X ranges from 0 to dynamicInputCount - 1. The number of rows in each input matrix must be divisible by the number of rows in the key column. If N is the number of rows in an input matrix and M is the number of rows in the key column with N = k * M, then the sorting is applied to blocks of k rows.

  • keyColumn: The (zero-based) index of a sort key in input0. All output matrices, including input0, will be sorted based on values on this column.

  • order: Sorting order.

  • algorithm: Sorting algorithm.

  • locale: The locale used for string sorting. The β€œC” locale commonly used in programming is identical to β€œen_US”. An empty value means the locale will be automatically chosen based on the settings of the user’s operating system.

  • ignorePunctuation: If true, punctuation characters and symbols are ignored when determining sort order. Otherwise, they are treated as sortable characters. If false, the behavior depends on locale.

  • caseSensitive: If true, the string sorting algorithm is case sensitive. Otherwise, the case is ignored. Notice that case is used only for breaking the tie between otherwise identical strings. For example, β€œabc” < β€œABC” but β€œABC0” < β€œabc1”.

OutputsπŸ”—

  • permutation: A matrix that stores the original index of each row in the input matrix.

  • outputX: A matrix or table that contains the rows received in inputX, sorted according to values of the key column.

Locale codesπŸ”—

If you need to manually craft a locale code, the format is β€œlanguage[_script][_country]”, where:

  • language is a lowercase, two-letter, ISO 639 language code (also some three-letter codes),

  • script is a titlecase, four-letter, ISO 15924 script code,

  • country is an uppercase, two-letter, ISO 3166 country code (also β€œ419” as defined by United Nations), and codeset and modifier are ignored.

enum OrderπŸ”—

Sorting order.

Values:

enumerator AscendingπŸ”—

Sort in ascending order.

enumerator DescendingπŸ”—

Sort in descending order.

enum AlgorithmπŸ”—

Sorting algorithm.

Values:

enumerator NumericSortπŸ”—

Input values are converted to numbers before sorting.

If an input value is a string which can not be converted to a number, the value is treated as if it was zero.

enumerator StringSortπŸ”—

Input values are converted to strings before sorting and string ordering rules are applied.

For example, β€œ100” is less than β€œ99”.