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

Home » Public Forums » archive » Arrays of 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: Arrays of Structures [message #52446 is a reply to message #20472] Thu, 08 February 2007 12:52 Go to previous messageGo to previous message
news.qwest.net is currently offline  news.qwest.net
Messages: 137
Registered: September 2005
Senior Member
<mgalloy@gmail.com> wrote in message
news:1170966075.702031.236230@k78g2000cwa.googlegroups.com.. .
> On Feb 8, 12:09 pm, "R.G. Stockwell" <n...@email.please> wrote:
>> "Mick Brooks" <mick.bro...@gmail.com> wrote in message
>>
>> news:1170957886.387622.208430@l53g2000cwa.googlegroups.com.. .
...
> I'm not sure that is an expression thing either. When I try to index
> an expression, I get a syntax error:
>
> IDL> print, findgen(10)[5]
>
> print, findgen(10)[5]
> ^
> % Syntax error.

Right. This is a syntax error. IDL does not know how to parse it.
The difference is that struct.a[5] is not a syntax error, idl does know
and must know how to parse that expression. In this case though, it
is trying to access the 5th element of a, which is out of bounds.
Note that the following works

IDL> help,struct.a[0]
<Expression> INT = Array[50]


(and the rest of your post made sense to me.)

The point is, that struct is an array. If you want to acces
the array elements you must do
IDL> structs[*].a.
Or IDL lets you cast the expression into a temporary array as follows:
IDL> help, (struct.a)[22]
<Expression

IDL> help,junk.a

<Expression> INT = Array[50]

IDL> help,(junk.a)

<Expression> INT = Array[50]

> INT = 1



The original point I made is that you cannot dereference an expression, you

have to have parenthesis on it.

Cheers,
bob
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: image rotation Fits headers?
Next Topic: .sav format

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

Current Time: Wed Oct 08 17:19:32 PDT 2025

Total time taken to generate the page: 0.00364 seconds