User Guide > Creating and Querying Tables > Other Methods of Subsetting and Sorting Variables
  

Other Methods of Subsetting and Sorting Variables
PV‑WAVE provides other functions for subsetting and sorting the values in one-dimensional arrays. The SORT function sorts the subscripts of an array into ascending order. For example:
array = [4, 3, 7, 1, 2]
index = SORT(array)
PRINT, index
; PV-WAVE prints:  3   4   1   0   2
This results because: A3 < A4 < A1 < A0 < A2. To see the sorted array, enter:
PRINT, array(index)
; PV-WAVE prints:  1   2   3   4   7
The WHERE function allows the use of Boolean expressions to select ranges of subscripts in an array. For example:
index = WHERE((array GT 50) AND (array LT 100))
result = array(index)
For more information on these functions, see the online help.

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.