Method on @sym: sort (f)

Order the elements in increasing order.

Example:

sort([sym(2), sym(1)])
  ⇒ ans = (sym) [1  2]  (1×2 matrix)

For matrices, sort orders the elements within columns

s = sort([sym(2), sym(1); sym(3), sym(0)])
  ⇒ s = (sym 2×2 matrix)

      ⎡2  0⎤
      ⎢    ⎥
      ⎣3  1⎦

See also: @sym/unique.

Package: symbolic