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

Home » Public Forums » archive » Re: work with 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: work with structures [message #73606] Wed, 17 November 2010 08:13 Go to previous message
Jean[2] is currently offline  Jean[2]
Messages: 41
Registered: October 2010
Member
On Nov 17, 11:11 am, Michael Galloy <mgal...@gmail.com> wrote:
> On 11/17/10 9:00 AM, Jean wrote:
>
>
>
>> I have a program that takes a structure as one of its argument. I want
>> this program to parse and display its contains.
>
>> The structue may looks like this:
>
>> structure = { var1: {label:'label of var1', value:'value of var1'},$
>>                      var2: {label:'label of var2', value:'value of
>> var2'},$
>>                      ... }
>
>> I'm not supposed to know in advance the name of var1. Using tag_names,
>> I was able to retrieve those names, but know I need to get the label
>> and value of each of them and this is where I'm stuck.
>
>> of course doing something like
>
>> list_var = tag_names(structure)
>> for i=0,n_tags(structure)-1 do begin
>>     print, structure.list_var[i].label          !!! not working
>> endfor
>
>> did not work !
>
>> Any idea how I can do that ?
>
>> Jean
>
> Try:
>
> list_var = tag_names(structure)
> for i = 0L, n_tags(structure) - 1L do begin
>    print, list_var[i], structure.(i).label, structure.(i).value
> endfor
>
> Mike
> --www.michaelgalloy.com
> Research Mathematician
> Tech-X Corporation

That's exactly what I was looking for. Thanks guys.

Jean
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: PostScript Background Color Preference
Next Topic: NG Colorbar in IDL 8.0.1

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

Current Time: Wed Oct 08 19:15:35 PDT 2025

Total time taken to generate the page: 0.00449 seconds