sort

From DavinciWiki
Jump to: navigation, search


64-bit SafeYes

Description

Alpha-numeric sorting

The sort() function sorts an array of numbers (or text) in ascending order (alphabetic), producing an array with the same format, organization and size of the original array.

Arguments and Return Values

Arguments: An array of numbers or TEXT

Return Value: A sorted array of numbers or strings

Usage

Syntax: sort(object = VAL[, by = VAL][, descend = INT])

'object' - a numeric array or text array

'by' - optional object by which to sort the data object

'descend' - option to order by decreasing value. Default = 0 (ascending)

To sort arrays with two or more dimensions greater than 1 (e.g. 2x100x1, 30x70x60, etc.) you must use the 'by' option. The 'by' array must be 1 dimensional and have the same number of elements in that dimension as the object to be sorted.

For example: You have the object dataset with dimensions 40x197x1. You may sort it by an array with the following dimensionality: 1x197x1 or 40x1x1.

Examples

dv> a   
10x1x1 array of float, bsq format [40 bytes]
0.753022        0.732036        0.312907        0.0849177       0.516326
0.372720        0.997992        0.0799942       0.521901        0.753748 

dv> b = sort(a)
10x1x1 array of float, bsq format [40 bytes]
0.0799942       0.0849177       0.312907        0.372720        0.516326
0.521901        0.732036        0.753022        0.753748        0.997992

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Related Functions

Recent Core Changes

Modified On: 10-01-2009

Personal tools