# Sorting

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.
numeric
If true, the string sorting algorithm will place "99" before "100". Otherwise, numbers are treated as characters.
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.

## 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.