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

Home » Public Forums » archive » Re: indexing structure of 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: indexing structure of structures [message #49370] Tue, 18 July 2006 08:28
Phony Account is currently offline  Phony Account
Messages: 14
Registered: May 2005
Junior Member
Ben Tupper wrote:
> phaccount@nycap.rr.com wrote:
>> Hello group,
>>
>> I am analyzing a bunch of data from an experimental series. The
>> analysis from each experiment (numbers a,b,c,... etc) is stored in a
>> structure. For reasons that have little to do with foresight and
>> expedience, I decided to store all the individual structures in one
>> large structure (This allows me to add some more fluff).
>>
>> My problem is how to extract the parameter 'a' to plot it. I was
>> hoping that an array indexing method such as
>>
>> outer_struct.([1,4,8,12]).a
>>
>> would work, but it does not. So I am re-packaging the outer structure
>> as a vector of inner_structures.
>>
>> Am I missing something in the IDL syntax that would allow me to keep
>> the structure of structures, and vectorially index the substructures?
>>
>
> Hello,
>
> I think you really do want a vector of stuctures - assuming that each of
> the structures have the same form. If that is what you want then the
> notation is very simple. Try the following...
>
> vec = REPLICATE($
> {NAME: STRING(randomn(n, 1)*100, format = '(I3.3)'), $
> DATA: INDGEN(4)}, 5)
> help, vec
> subvec = vec[2:4]
> help, subvec
> subname = vec[2:4].name
> help, subname
> subdata = vec[2:4].data
> help, subdata
> subsubdata = vec[2:4].data[3]
> help, subsubdata
>
> Cheers,
> Ben

Yep, that is the way I finally went.

Thanks Ben,

Mirko
Re: indexing structure of structures [message #49375 is a reply to message #49370] Tue, 18 July 2006 05:46 Go to previous message
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
phaccount@nycap.rr.com wrote:
> Hello group,
>
> I am analyzing a bunch of data from an experimental series. The
> analysis from each experiment (numbers a,b,c,... etc) is stored in a
> structure. For reasons that have little to do with foresight and
> expedience, I decided to store all the individual structures in one
> large structure (This allows me to add some more fluff).
>
> My problem is how to extract the parameter 'a' to plot it. I was
> hoping that an array indexing method such as
>
> outer_struct.([1,4,8,12]).a
>
> would work, but it does not. So I am re-packaging the outer structure
> as a vector of inner_structures.
>
> Am I missing something in the IDL syntax that would allow me to keep
> the structure of structures, and vectorially index the substructures?
>

Hello,

I think you really do want a vector of stuctures - assuming that each of
the structures have the same form. If that is what you want then the
notation is very simple. Try the following...

vec = REPLICATE($
{NAME: STRING(randomn(n, 1)*100, format = '(I3.3)'), $
DATA: INDGEN(4)}, 5)
help, vec
subvec = vec[2:4]
help, subvec
subname = vec[2:4].name
help, subname
subdata = vec[2:4].data
help, subdata
subsubdata = vec[2:4].data[3]
help, subsubdata

Cheers,
Ben
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to save output log by profiler
Next Topic: Refine a vector layer in ENVI

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

Current Time: Wed Oct 08 15:34:44 PDT 2025

Total time taken to generate the page: 0.00550 seconds