math/
ord.pro
top source ord
Math
result = ord(values)
Calculates the ordinal of each value of an array in terms of the sorted values. This can be very useful for shrinking sparse arrays before using histogram.
Return value
Returns a long array with the same number of elements as Values, where each value is replaced by its ordinal (starting at 0). Identical values are given the same ordinal.
Parameters
- values in
A vector of values.
Examples
Calculate the ordinals of values in an array.
IDL> array = [5,6,7,4,5,6,-2]
IDL> print, ord(array)
2 3 4 1 2 3
0
Author information
- History:
Written by: Jeremy Bailin 28 March 2009 Public release in JBIU 17 June 2011 Output same dimensional array as input, rather than flat.
File attributes
| Modification date: | Fri Jun 17 12:27:57 2011 |
| Lines: | 54 |
![[attach.png]](../idldoc-resources/attach.png)