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

Home » Public Forums » archive » Re: Odd behaviour in array indexing ?
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: Odd behaviour in array indexing ? [message #34185 is a reply to message #34182] Fri, 21 February 2003 07:40 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
mwvogel (mvogel@rdiag.fgg.eur.nl) writes:

> Today I realized something is amiss in IDL
> When I do
> index = [1,0,2,3,1,2,3,4]
> m = FLTARR(8)
> d = FINDGEN(8)
> m[index] = d
> print, m
> 1.00000 4.00000 5.00000 6.00000 7.00000
> 0.000000 0.000000 0.000000
>
> Now I would have assumed that IDL would automatically *add* the numbers with
> identical indices. Not doing
> so is a potential performance penaly, right ? Or am I mistaken....

I find it hard to say what exactly you are trying to
do here, but IDL seems to be working exactly as I would
expect it to. Variables on the left hand side of the
expression are having things assigned to them. I'm not
sure why you think the assignments should *add*. If I do
this:

a = intarr(2)
a[1] = 5

And later,

a[1] = 6

I sure don't want a[1] to equal 11. That is exactly
what you seem to be asking for above.

Cheers,

David

--

David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Plotting to more than one window
Next Topic: Altivec support in ENVI and/or IDL?

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

Current Time: Thu Oct 09 23:05:30 PDT 2025

Total time taken to generate the page: 0.32227 seconds