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

Home » Public Forums » archive » Re: indexing over structure tags
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: indexing over structure tags [message #24814 is a reply to message #24813] Thu, 19 April 2001 10:00 Go to previous message
Paul van Delst is currently offline  Paul van Delst
Messages: 364
Registered: March 1997
Senior Member
Randall Skelton wrote:
>
> Hello,
>
> Imagine someone has a structure of structures...
>
> ; define the basic structure for each
> sm_struc = {basic_struct, comment: ' ', values: fltarr(nlev)}
>
> ; define the large structure
> data = {big_struct, so4: sm_struc, co2: sm_struc, hcl: sm_struc}
>
> The IDL manual describes how to make an array of the tags in a structure
> using:
>
> ; get the names of the tags
> names = tag_names(data)
>
> so that names = [so4, co2, hcl].
>
> That is all fine. But is it possible to index over the tag names with a
> for-loop?
>
> i.e. for i=0, n_elements(names)-1 do data.names[i].values = i
> ^^^^^^^^^^^^^^^^^^^^

Maybe

data.names[i].(j) where j=0->N_TAGS(data.names[i])-1 ??

This works on "single-level" structures but I don't see why it wouldn't work on nested
ones.

paulv

--
Paul van Delst A little learning is a dangerous thing;
CIMSS @ NOAA/NCEP Drink deep, or taste not the Pierian spring;
Ph: (301)763-8000 x7274 There shallow draughts intoxicate the brain,
Fax:(301)763-8545 And drinking largely sobers us again.
paul.vandelst@noaa.gov Alexander Pope.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: fastest operations/fctns.
Next Topic: MBAR

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

Current Time: Wed Oct 08 19:03:34 PDT 2025

Total time taken to generate the page: 0.00420 seconds