Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


  >  Docs Center  >  Libraries  >  ASTROLIB  >  REM_DUP

REM_DUP

REM_DUP

Name


REM_DUP

Purpose


Function to remove duplicate values from a vector.

Calling Sequence


result = rem_dup( a, [ flag ] )

Inputs


a - vector of values from which duplicates are to be found
flag - (optional) if supplied then when duplicates occur,
the one with the largest value of flag is selected.
If not supplied the the first occurence of the value
in a is selected. Should be a vector with the same
              number of elements as a.

Output


A vector of subscripts in a is returned. Each subscript
points to a selected value such that a(rem_dup(a,flag))
has no duplicates.

Side Effects


The returned subscripts will sort the values in a in ascending
order with duplicates removed.

Examples



Remove duplicate values in vector a.
a = a[ rem_dup(a)]
Remove duplicates in vector WAVE. When duplicate values
are found, select the one with the largest intensity, INTE.
sub = rem_dup( wave, inte)
wave = wave[sub]
inte = inte[sub]

Notes


The UNIQ function in the User's Library uses a faster algorithm,
but has no equivalent of the "flag" parameter. Also, note that
      REM_DUP() gives the index of the *first* equal value found, while
      UNIQ() gives the index of the *last* equal value found.

Modification History


D. Lindler Mar. 87
11/16/90 JKF ACC - converted to IDL Version 2.
August 1997 -- Changed loop index to type LONG
October 1997 -- Also changed NGOOD index to LONG
      April 2007 - Use faster algorithm when Flag vector not set, W. Landsman
      Feb 2011 - Remove spurious line W.L.
      Jan 2012 - Call BSORT() to ensure original order maintained for equal
            values



© 2018 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us