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

Home » Public Forums » archive » Variable stride in array indices
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: Variable stride in array indices [message #15454 is a reply to message #15249] Tue, 18 May 1999 00:00 Go to previous messageGo to previous message
bowman is currently offline  bowman
Messages: 121
Registered: September 1991
Senior Member
In article <3732EFA0.1F6C49C0@ssec.wisc.edu>, Liam Gumley
<Liam.Gumley@ssec.wisc.edu> wrote:

> Or I can select the columns and rows at the same time:
>
> IDL> print,(a[x,*])[*,x]
> 0 2 4 6 8
> 20 22 24 26 28
> 40 42 44 46 48
> 60 62 64 66 68
> 80 82 84 86 88

I had a chance to look at my code to see if Liam's suggestion would work,
and I realized that it won't, because I need to use the variable stride on
the *left* side of the equal sign, i.e.

IDL> a = LINDGEN(6,6)
IDL> print, a
0 1 2 3 4 5
6 7 8 9 10 11
12 13 14 15 16 17
18 19 20 21 22 23
24 25 26 27 28 29
30 31 32 33 34 35
IDL> print, (a[*,2*LINDGEN(3)])[2*LINDGEN(3),*]
0 2 4
12 14 16
24 26 28

works fine *extracting* data, but

IDL> (a[*,2*LINDGEN(3)])[2*LINDGEN(3),*] = -1
% Temporary variables are still checked out - cleaning up...
IDL> PRINT, A
0 1 2 3 4 5
6 7 8 9 10 11
12 13 14 15 16 17
18 19 20 21 22 23
24 25 26 27 28 29
30 31 32 33 34 35

fails.

So it is possible to extract values (gather) but not to insert values
(scatter) with a variable stride using this method.

I repeat my call for a simple stride syntax in IDL

a[0:5:2,0:5:2] = -1

Ken

--
Dr. Kenneth P. Bowman, Professor 409-862-4060
Department of Meteorology 409-862-4466 fax
Texas A&M University bowmanATcsrp.tamu.edu
College Station, TX 77843-3150 Replace AT with @
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL Program Updates
Next Topic: divide by zero problems

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

Current Time: Fri Oct 10 10:04:37 PDT 2025

Total time taken to generate the page: 1.91897 seconds