>  Docs Center  >  Libraries  >  ASTROLIB  >  WHERE_TAG
Libraries

WHERE_TAG

WHERE_TAG

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 occurences 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 <xxx> not found" with /NOPRINT, CD Pike 8-Jun-93
      Use STRJOIN for display W.L. July 2009



© 2024 NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us