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

Home » Public Forums » archive » indexing a structure in a list
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
indexing a structure in a list [message #87472] Wed, 05 February 2014 08:36 Go to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
Hi,
I've got the feeling this should work, but for some reason it isn't.
So here is some code to test the problem with the errors describe in it:

PRO testStrutRef
Compile_Opt idl2
a = list(findgen(10), /extract)
a[4] = {value:3.0}
help, a[4], /struct
;a[4].value = 4.0 ;won't work: % Attempt to store into an expression: Structure reference.
;(a[4]).value = 4.0 ;won't work: % Attempt to store into an expression: Structure reference.
;((a)[4]).value = 4.0 ;won't work: % Attempt to store into an expression: Structure reference.
struct = a[4]
struct.value = 4.0
a[4] = struct ;works, but not really straight forward...
print, a
END

It seems like I can't address a structure element of a list directly.
Did I misplace my parenthesis? Is there a less cumbersome workaround?

Thanks,
Helder
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL as Art
Next Topic: How to make multiple plots on multiple pages with the same figure filename?

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

Current Time: Wed Oct 08 18:18:14 PDT 2025

Total time taken to generate the page: 0.00195 seconds