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

Home » Public Forums » archive » Re: Maddening 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: Maddening structures [message #50223 is a reply to message #50222] Mon, 18 September 2006 05:23 Go to previous messageGo to previous message
Edd Edmondson is currently offline  Edd Edmondson
Messages: 50
Registered: January 2003
Member
Maarten <maarten.sneep@knmi.nl> wrote:

> Edd wrote:
>> OK, I've got some data read in so that I have a structure that looks
>> like
>>
>> data.foo[600]
>> .bar[600]
>> .baz[600]
>>
>> and I want
>> data[600].foo
>> .bar
>> .baz
>>
>> In other words I want an array of structures rather than a structure
>> of arrays.
>>
>> Does anyone have any magic that works for the case when foo, bar and
>> baz are not previously known?

> Perhaps my reading comprehension isn't quite awake yet, but:

> 1) do you mean the names themselves, or the number of fields (there may
> also be a fuu around, in addition to the foo, bar and baz)?

I'd basically like the most general method I can find (so I don't have
to go recoding stuff when another field gets added a week or two down
the line). So number and naming of fields should be considered flexible.

> Get the names with tag_names(data), obtain the length with
> size(data.(0), /dim), create a base struct with base =
> CREATE_STRUCT(...) and replicate() the base to the right size. At least
> that is where I would look. Copying is another matter, perhaps others
> can comment on how to do this efficiently. At least you have the right
> structure to store the stuff.

That's where I was looking too. I wasn't sure how to handle the
structure creation nearly though. Once you have the tag names you can
loop over them in a for loop (there won't be that many tags anyway) so
it's not too bad. Just a bit hairy. It'd be nice if there was a
reform-alike. :-)

I may try for an alternative workaround, as rejigging the other bits
probably involves less recoding than doing the jigging with this.

--
Edd
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: calculating rotations from a transformation matrix
Next Topic: IMSL coming to IDL

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

Current Time: Thu Oct 09 07:48:06 PDT 2025

Total time taken to generate the page: 1.03238 seconds