;+ ; NAME: ; unique_only ; PURPOSE: ; Return unique elements in array ; CATEGORY: ; gen/pro/toolbox ; CALLING SEQUENCE: FUNCTION unique_only, tmp ; INPUTS: ; tmp array; type: any ; OUTPUTS: ; R indices of unique elements in ; the same order as in the input ; array. ; INCLUDE: @compile_opt.pro ; On error, return to caller ; PROCEDURE: ; The difference with the IDL uniq function is that ; the order of the elements in the original array ; is retained: ; IDL> a = [2,1] ; IDL> print, a[uniq(a,sort(a))] ; 1 2 ; print, a[unique_only(a)] ; 2 1 ; MODIFICATION HISTORY: ; FEB-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- i = sort(tmp) i = i[uniq(tmp,i)] RETURN, i & END