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

Home » Public Forums » archive » Re: structure arrays with different structures
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: structure arrays with different structures [message #81377] Mon, 10 September 2012 06:43
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Why not use a list of structures? (Assuming you have IDL v8.x).

Just add each structure to the list as it's created.

If you can avoid using pointers (directly at least), you should (IMO).

cheers,

paulv


On 09/08/12 21:08, S�ren Frimann wrote:
> Hi all,
>
> I'm having some data that's gathered together in different structures
> and arrays, and I want to collect everything in a structure array in
> this manner:
>
> struct_template = { name:'', select:{} , obs:dblarr(2,100)}
>
> I want to put my data into struct_template, with name being a string,
> select being another structure, and obs being an array.
>
> I then want to make an array of structures using struct_template, but
> naturally with different sets of data.
>
> The issue is that the select structure does not always have the same
> skeleton, nor does the obs array always have the same size.
>
> The question basically is if there's any way of making an array of
> structures with the structures sharing the same keys, but with the
> values having different 'skeletons'
>
> I hope I'm making sense
>
> Cheers, S�ren
Re: structure arrays with different structures [message #81382 is a reply to message #81377] Sun, 09 September 2012 04:33 Go to previous message
Søren Frimann is currently offline  Søren Frimann
Messages: 13
Registered: November 2010
Junior Member
Den søndag den 9. september 2012 06.18.49 UTC+2 skrev Craig Markwardt:
> On Saturday, September 8, 2012 9:08:39 PM UTC-4, Søren Frimann wrote:
>
>> Hi all,
>
>>
>
>>
>
>>
>
>> I'm having some data that's gathered together in different structures and arrays, and I want to collect everything in a structure array in this manner:
>
>>
>
>>
>
>>
>
>> struct_template = { name:'', select:{} , obs:dblarr(2,100)}
>
>>
>
>>
>
>>
>
>> I want to put my data into struct_template, with name being a string, select being another structure, and obs being an array.
>
>>
>
>>
>
>>
>
>> I then want to make an array of structures using struct_template, but naturally with different sets of data.
>
>>
>
>>
>
>>
>
>> The issue is that the select structure does not always have the same skeleton, nor does the obs array always have the same size.
>
>>
>
>>
>
>>
>
>> The question basically is if there's any way of making an array of structures with the structures sharing the same keys, but with the values having different 'skeletons'
>
>
>
> You want to use pointers. It's what pointers were invented for.
>
>
>
> However, don't go overboard with pointers. It can create a managerial nightmare. I would advise you to keep the basic structure the same, so you can have an array of identical structures. Use pointers for your OBS field and other variations from entry to entry.
>
>
>
> Craig

Thanks for the pointer (very bad pun intended) :-)

-Søren
Re: structure arrays with different structures [message #81383 is a reply to message #81382] Sat, 08 September 2012 21:18 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Saturday, September 8, 2012 9:08:39 PM UTC-4, Søren Frimann wrote:
> Hi all,
>
>
>
> I'm having some data that's gathered together in different structures and arrays, and I want to collect everything in a structure array in this manner:
>
>
>
> struct_template = { name:'', select:{} , obs:dblarr(2,100)}
>
>
>
> I want to put my data into struct_template, with name being a string, select being another structure, and obs being an array.
>
>
>
> I then want to make an array of structures using struct_template, but naturally with different sets of data.
>
>
>
> The issue is that the select structure does not always have the same skeleton, nor does the obs array always have the same size.
>
>
>
> The question basically is if there's any way of making an array of structures with the structures sharing the same keys, but with the values having different 'skeletons'

You want to use pointers. It's what pointers were invented for.

However, don't go overboard with pointers. It can create a managerial nightmare. I would advise you to keep the basic structure the same, so you can have an array of identical structures. Use pointers for your OBS field and other variations from entry to entry.

Craig
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Can't launch IDL DE anymore...
Next Topic: Re: Off-kilter z-axis label in function graphics?

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

Current Time: Wed Oct 08 15:26:29 PDT 2025

Total time taken to generate the page: 0.00614 seconds