Inform me () when using this script or encorporating it in a library.
Source code of unmatch.pro:
;+
; NAME:
; UNMATCH
; PURPOSE:
; Remove the given indices from all indices of a vector with the
; given length
; CALLING SEQUENCE:
; result = UNMATCH(idx, N_ELEMENTS(arr))
; EXAMPLES:
; a = dindgen(10)
; b = WHERE(a MOD 3 EQ 1)
; c = UNMATCH(b, N_ELEMENTS(a))
; c now contains all indices where a MOD 3 NE 1
; KEYWORDS:
; idx =
; N_ELEMENTS(arr) = size of the array in one dimensional space
; REMARKS:
; The example shows a case where one can easily get the other
; values by means of rewriting the WHERE statement. This routine
; is much more useful for when this is not possible, such as
; wanting to have the opposite behaviour of MATCH, i.e. wanting
; to have the indices of the values that do *NOT* match another
; array.
; For higher dimension removal, use UNMATCH in combination with
; ARRAY_INDICES and INDICES_ARRAY. First convert the
; multi-dimensional coordinates to one-dimensional coordinates,
; remove them with UNMATCH and convert back to multi-dimensional
; coordinates.
; DEPENDENCIES:
; astro library REMOVE
; MODIFICATION HISTORY:
; 15/01/07 written by Eduard Westra
;-
FUNCTION unmatch, idx, no
IF N_ELEMENTS(no) NE 1 THEN BEGIN
MESSAGE, /CONTINUE, 'Not a value, but array. Just taking the N_ELEMENTS of it...'
lno = N_ELEMENTS(no)
ENDIF ELSE BEGIN
lno = no
ENDELSE
idxRemoved = INDGEN(lno, TYPE=SIZE(lno, /TYPE))
REMOVE, idx, idxRemoved
RETURN, idxRemoved
END