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

Home » Public Forums » archive » subscript array 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
subscript array question [message #14309] Thu, 11 February 1999 00:00 Go to previous message
bennetsc is currently offline  bennetsc
Messages: 18
Registered: January 1998
Junior Member
I'm using IDL 5.0 and need to be able to use a subscript
array containing duplicate values like this:

array = intarr(5)
subs = [0,2,4,4]
array[subs] = array[subs] + 1

and have the resulting values for array be:

1 0 1 0 2

Because of the way IDL manages memory for expression evaluation
and assignments, what happens for the last two elements of the
addition is that the original value of array[4] is used twice,
rather than what I want, which is to use the current value of
array[4] each time. I.e. IDL gives the resulting values for
array to be:

1 0 1 0 1

So is there a way to do what I want without resorting to
a loop? In my real-world application, I'm using two different
subscript arrays together to index into and update a two-
dimensional table. Having duplicate pairs of subscripts from
the two subscript arrays is expected to occur very frequently.


Scott Bennett, Comm. ASMELG, CFIAG
Dept. of Atmospheric Sciences
Oregon State University
Corvallis, Oregon 97331
************************************************************ **********
* Internet: sbennett@oce.orst.edu *
*----------------------------------------------------------- ---------*
* "The jury has a right to judge both the law as well as the fact in *
* controversy."--John Jay, First Chief Justice, U.S. Supreme Court *
* in Georgia vs. Brailsford, 1794 *
************************************************************ **********
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Non-Blocking I/O
Next Topic: How do I prevent underflow errors?

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

Current Time: Wed Oct 08 16:47:57 PDT 2025

Total time taken to generate the page: 0.00371 seconds