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

Home » Public Forums » archive » structure access using strings for tag-names
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: structure access using strings for tag-names [message #43428 is a reply to message #43427] Mon, 11 April 2005 05:31 Go to previous messageGo to previous message
Paolo Grigis is currently offline  Paolo Grigis
Messages: 171
Registered: December 2003
Senior Member
Try this out:

;get list of tag names
tagnamelist=tag_names(!P)

;find which tag has the name "MULTI"
tagindex=where(tagnamelist EQ 'MULTI')

;access the structure
print,!p.(tagindex)

You can use struct.(0), struct.(1) etc. to access the values
in the first, second,... tag.

--Paolo


Thomas Pfaff wrote:
> Hello everyone,
>
> I would like to ask your opinion about the following.
>
> Using the function CREATE_STRUCT it is possible to create a struct with
> tag names defined by strings. This way it is possible to create structs
> without knowing their names at compile time.
>
> However even if I don't have to know the tag names when creating a
> struct, it seems that I still have to know them, when I want to acccess
> the data within that struct, because I couldn't find any procedure or
> function for this purpose and struct.'tag_name' quite naturally gives a
> syntax error.
>
> Any ideas why this isn't implemented, or why it isn't necessary to have
> it (would be nice to set up simple associative containers, wouldn't it)?
>
> Best regards,
>
>
> Thomas
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: dereferencing a pointer to a complex structure?
Next Topic: problem with xroi continued....

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

Current Time: Mon Dec 01 13:30:21 PST 2025

Total time taken to generate the page: 1.04186 seconds