idlastro / IDL Structure procedures: WHERE_TAG

[Source code]

NAME
WHERE_TAG
PURPOSE
Like WHERE but works on structure tag names
EXPLANATION
Obtain subscripts of elements in structure array for which
a particular Tag has values in a range or matching specified values.
Like the WHERE function but for use with structures
CATEGORY
Structures
CALLING SEQUENCE
w = where_tag( struct, [ Nfound,  TAG_NAME=, TAG_NUMBER = , RANGE =, 
                       VALUES =, RANGE =, ISELECT =, /NOPRINT ]
INPUTS
Struct = structure array to search.
INPUT KEYWORDS
User *must* specify (1) TAG_NAME or TAG_NUMBER to search, and (2)
        the VALUES or RANGE to search on
TAG_NAME = Scalar string specifying Tag Name
TAG_NUMBER = otherwise give the Tag Number,
RANGE = [min,max] range to search for in Struct,
VALUES = one or array of numbers to match for in Struct,
ISELECT= specifies indices to select only part of structure array,
        (use it to recycle subscripts from previous searches).
/NOPRINT = suppress informational messages about nothing found.
OUTPUTS
Nfound = # of occurrences found.
RESULT
Function returns subscripts (indices) to desired elements.
EXAMPLES
Suppose STR is a structure with tags CAT_NO:indgen(10), and 
        NAME:strarr(10).   Find the indices where STR.CAT_NO is
        between 3 and 5.
IDL> print, WHERE_TAG( str, TAG_NAME = 'CAT_NO', VALUE = [3,4,5] )  ;or
IDL> print, WHERE_TAG( str, TAG_NUM = 0, RANGE = [3,5]) 
PROCEDURE
Get tag number and apply the WHERE function appropriately.
MODIFICATION HISTORY
written 1990 Frank Varosi STX @ NASA/GSFC
Stop printing "Tag  not found" with /NOPRINT, CD Pike 8-Jun-93
se STRJOIN for display  W.L. July 2009