comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: calling a structure tag as a variable?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: calling a structure tag as a variable? [message #79438] Mon, 27 February 2012 11:28 Go to previous message
desertdryad is currently offline  desertdryad
Messages: 39
Registered: August 2011
Member
Ah, yes. Thanks so much, guys! I went via Paul's method.




On Feb 27, 10:06 am, Paul van Delst <paul.vande...@noaa.gov> wrote:
> David Fanning wrote:
>> Paul van Delst writes:
>
>>> How about something like:
>
>>> PRO process_mystructure, $
>>>       mystructure, $  ; The structure
>>>       tag             ; The tag name on which to operate
>
>>>   tag_idx = WHERE(TAG_NAMES(mystructure) EQ tag, count)
>>>   IF ( count NE 1 ) THEN MESSAGE, 'Invalid input tag'
>
>>>   ; Pull out data to operate on
>>>   data = mystructure.(tag_idx[0])
>
>>>   ....operate on data...calling separate, generic procedure?
>
>>>   ; Stick it back in the structure
>>>   mystructure.(tag_idx[0]) = data
>
>>> END
>
>> I'd remember to make that tag UPPERCASE or you
>> are *never* going to find it! ;-)
>
> Good point.
>
>   tag_idx = WHERE(TAG_NAMES(mystructure) EQ STRUPCASE(tag), count)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: calling a structure tag as a variable?
Next Topic: SHIFT Function

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 05:31:38 PDT 2025

Total time taken to generate the page: 0.00648 seconds