From 12:00 PM - 8:00 PM CST on Thursday, October 18, ni.com will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

sortrows

Version:

Sorts the rows of a matrix.

Syntax

c = sortrows(a)
c = sortrows(a, b)
[c, d] = sortrows(a)
[c, d] = sortrows(a, b)

a

Matrix with the rows to be sorted.

b

Columns of a for sorting the rows. b is a vector of integral numbers.

c

Sorted rows of a. Sorts the rows of a in ascending order if elements of b are positive. Sorts the rows of a in descending order if elements of b are negative. MathScript sorts complex vectors by magnitude and angle, in that order. c is a matrix of the same size as a.

d

Row indexes in a of the rows in c. d is a vector of integral numbers. The output data type is double precision floating-point number.

A = [6, 2, 3, 4; 4, 3, 2, 1];
[C, D] = sortrows(A, [1, 2])

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported