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

Home » Public Forums » archive » Re: structures still confusing
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: structures still confusing [message #49077 is a reply to message #49073] Tue, 13 June 2006 01:13 Go to previous messageGo to previous message
Allan Whiteford is currently offline  Allan Whiteford
Messages: 117
Registered: June 2006
Senior Member
Martin,

print,(s.m)[0]

is probably less confusing. Similarly you can do:

print,(s.m)[0,1]

but you can't do:

print,s.m[0,1]

or, you can also do:

print,(s.m[0])[1]

Thanks,

Allan

Martin Rother wrote:
> Hi Gurus,
>
> finally something, where I don't know,
> if it's odd idl syntax or not...
>
> something about structures.
>
> FUNCTION test_struct
>
> s = [{ m : [1L, 2L, 3L], n :1L }]
>
> FOR i = 1L, 2L DO BEGIN
> ;
> s = [s, { m : [1L, 2L, 3L], n : i }]
> ;
> ENDFOR
>
> return, s
>
> END
>
> this creates an array of structures:
>
> (X). s = test_struct()
> (X). help,/struct,s
> ** Structure <fa330>, 2 tags, length=16, data length=16, refs=1:
> M LONG Array[3]
> N LONG 1
> (X). print, n_elements(s)
> 3
> (X).
>
> so far ok, I guess. but
>
> (X). help,s.m
> <Expression> LONG = Array[3, 3]
> (X). print, s.m
> 1 2 3
> 1 2 3
> 1 2 3
> (X). print, s.m[0]
> 1 1 1
> (X). print, s.m[1]
> 2 2 2
> (X). print, s.m[2]
> 3 3 3
>
> is a *bit* confusing. isn't it?
>
>
> best regards,
> martin.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: procedure name quirk
Next Topic: Using Windows IDL to access a UNIX database using DLM's

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

Current Time: Wed Oct 08 15:17:38 PDT 2025

Total time taken to generate the page: 0.00401 seconds