The
UNIQ function
returns the subscripts of the unique elements in an array. Note that repeated elements must be adjacent in order to be found. This routine is intended to be used with the SORT function: see the examples below. This function was inspired by the Unix
uniq(1)
command.
UNIQ returns an array of indices into the original array. Note that the index of the last element in each set of non-unique elements is returned. The following expression is a copy of the sorted array with duplicate adjacent elements removed:
UNIQ returns 0 (zero) if the argument supplied is a scalar rather than an array.
This routine is written in the IDL language. Its source code can be found in the file
uniq.pro
in the
lib
subdirectory of the IDL distribution.
The array to be scanned. For UNIQ to work properly, the array must be sorted into monotonic order unless the optional parameter Idx is supplied.