Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

sort (MathScript RT Module Function)

LabVIEW 2011 MathScript RT Module Help

Edition Date: June 2011

Part Number: 373123B-01

»View Product Info

Owning Class: basic

Requires: MathScript RT Module

Syntax

c = sort(a)

c = sort(a, b)

c = sort(a, order)

c = sort(a, b, order)

[c, d] = sort(a)

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

[c, d] = sort(a, order)

[c, d] = sort(a, b, order)

Description

Sorts the input elements in ascending or descending order.

Examples

Inputs

Name Description
a Specifies a real or complex vector or matrix.
b Specifies the dimension of a across which to sort if a is a matrix. b is a scalar that accepts the following values.

1 (default) Sorts the matrix by column.
2 Sorts the matrix by row.
order Specifies the direction by which to sort elements. order is a string that accepts the following values.

'ascend' (default) Sorts the elements in ascending order.
'descend' Sorts the elements in descending order.

Outputs

Name Description
c Returns the elements of a in ascending or descending order, depending on the value of order. LabVIEW sorts complex vectors by magnitude and angle, in that order. If a is a matrix, c returns a sorted by column or row, depending on the value of b. c is a vector or matrix of the same size as a.
d Returns the indexes in a of the elements in c. d is an integer vector or matrix of the same size as a.

Details

The following table lists the support characteristics of this function.

Supported in the LabVIEW Run-Time Engine Yes
Supported on RT targets Yes
Suitable for bounded execution times on RT Yes

Examples

A = [-1+2i, 3, -1-2i, -4]
[C, D] = sort(A)

Related Topics

sortrows


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit