David
Farruggio

MathGenie

sort

Sort array elements

Syntax and Description

sort(A) sorts the elements of A in ascending order along the first array dimension whose size does not equal 1.
  • If A is a vector, then sort(A) sorts the vector elements.
  • If A is a matrix, then sort(A) treats the columns of A as vectors and sorts each column.
  • If A is a multidimensional array, then sort(A) operates along the first array dimension whose size does not equal 1, treating the elements as vectors.
sort(A,dim) returns the sorted elements of A along dimension dim. For example, if A is a matrix, then sort(A,2) sorts the elements in each row.

Back to functions