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

Home » Public Forums » archive » Re: Combing structures
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: Combing structures [message #71188] Mon, 07 June 2010 09:37 Go to previous message
Steve[5] is currently offline  Steve[5]
Messages: 10
Registered: September 2007
Junior Member
Michael Williams wrote:
> Hi,
>
> I have two structures. Each contains a unique set of tags whose values
> are floats or arrays of floats. E.g.
>
> xx = findgen(5)
> y = 1.0
> str1 = {one: xx, two:y}
>
> xx = findgen(3)
> y = -1.0
> str2 = {three: xx, four: y}
>
> I want to merge them into one flat structure of their elements. At the
> moment I am doing this manually:
>
> str = {one:str1.one, two:str1.two, three:str2.three, four:str2.four}
>
> This obviously becomes unwieldy and error-prone when my structures
> have several dozen tags. Is there a way of automating the merge step?
> I am happy to assume the tag names are unique (i.e. there is no danger
> of a collision).
>
> I have played around with the tag_names function, but I can't see a
> way of using this without using the EVALUATE function, which is
> generally a bad idea.
>
> -- Mike

Try...

str=create_struct(str1, str2)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Testing if HDF5 file is corrupt
Next Topic: Vendor daemon is down

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

Current Time: Wed Oct 08 18:24:37 PDT 2025

Total time taken to generate the page: 0.00571 seconds