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

Home » Public Forums » archive » indexing over structure tags
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
indexing over structure tags [message #24816] Thu, 19 April 2001 09:28
Randall Skelton is currently offline  Randall Skelton
Messages: 169
Registered: October 2000
Senior Member
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
^^^^^^^^^^^^^^^^^^^^

where IDL determines what the appropriate label 'data.name[i].values' is.

Thanks,
Randall
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Equivalent of EXCEL LINEST function?
Next Topic: TRIANGULATE/TRIGRID problem in IDL 5.3 (SGI)

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

Current Time: Fri Oct 10 19:11:31 PDT 2025

Total time taken to generate the page: 0.40108 seconds