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

Home » Public Forums » archive » subscribing 3D arrays
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: subscribing 3D arrays [message #17274 is a reply to message #17135] Thu, 16 September 1999 00:00 Go to previous message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
Tom Wassenaar wrote:
>
> I can't figure out how to directly subscribe a group of individual cells
> in one layer of a 3D array.
>
> [...]
>
> b = indgen(3,3,3)
> b[[1,2],[2,1],0] = 0
> print, b[*,*,0]
>
> 0 1 2
> 3 0 0
> 6 0 0
>
> so a square envelope of cells set to zero
> Any suggestion ?

When the arrays of index values are of different lengths, IDL takes the subset
of each dimension separately. When you say b[[1,2],[2,1],0], this means all
points with X=1 or 2, Y=2 or 1, and Z=0: 2*2*1 = 4 array elements

What you want to do is give three equal-length arrays, one for each dimension.
Then IDL will take one array element for each corresponding set of three index
values:

b = indgen(3,3,3)
b[[1,2],[2,1],[0,0]] = 0
print, b[*,*,0]

0 1 2
3 4 0
6 0 8

The Replicate command can be useful for making an array of '0' values as long
as you need it.

Cheers,
--
-Dick

Dick Jackson Fanning Software Consulting, Canadian Office
djackson@dfanning.com Calgary, Alberta Voice/Fax: (403) 242-7398
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Filling an outline
Next Topic: Re: IDL and TCL interaction

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

Current Time: Wed Oct 08 17:51:09 PDT 2025

Total time taken to generate the page: 0.00387 seconds