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

Home » Public Forums » archive » Re: Expression question
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: Expression question [message #54264] Wed, 30 May 2007 16:29 Go to previous message
jkj is currently offline  jkj
Messages: 48
Registered: April 2007
Member
On May 30, 4:05 pm, shd <usenet_in...@yahoo.com> wrote:
> Code:
> =========================
> pro shd_test
>
> st = {a:0, b:0}
>
> arr = [st, st, st, st, st]
>
> help, st
> help, arr[0]
> help, (arr[0]).a
> help, arr.a
> help, (arr.a)[0]
>
> st.a = 1
> arr[0] = {a:1, b:0}
> (arr[0]).a = 1
> ;(arr.a)[0] = 1
> end
> ===========================
>
> Output:
> ===========================
> IDL> shd_test
> ST STRUCT = -> <Anonymous> Array[1]
> <Expression> STRUCT = -> <Anonymous> Array[1]
> <Expression> INT = 0
> <Expression> INT = Array[5]
> <Expression> INT = 0
> Attempt to store into an expression: Structure reference.
> Execution halted at: TEST_ODDITY 15 C:\Dev\IDL\projects\test
> \test_oddity.pro
> $MAIN$
>
> ===========================
>
> I can assign a value to "arr[0]" and not "(arr[0]).a". I also tried
> "(arr.a)[0]" and got a similar error. What am I missing here?

try this:
arr[0].a = 1
arr[1].b = 2
arr[2].a = 3

arr is an array of structures, so arr[i] allows you to access the ith
structure

-Kevin
[Message index]
 
Read Message
Read Message
Previous Topic: Expression question
Next Topic: How to re-index my IDL online help?

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

Current Time: Wed Oct 08 19:30:37 PDT 2025

Total time taken to generate the page: 0.00375 seconds