Institut für Astronomie und AstrophysikAbteilung AstronomieWaldhäuser Str. 64, D-72076 Tübingen, Germany |
WHERE_TAG
Like WHERE but works on structure tag names
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
Structures
w = where_tag( struct, [ Nfound, TAG_NAME=, TAG_NUMBER = , RANGE =, VALUES =, RANGE =, ISELECT =, /NOPRINT ]
Struct = structure array to search.
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.
Nfound = # of occurences found.
Function returns subscripts (indices) to desired elements.
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])
Get tag number and apply the WHERE function appropriately.
written 1990 Frank Varosi STX @ NASA/GSFC Stop printing "Tagnot found" with /NOPRINT, CD Pike 8-Jun-93
[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]