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

Home » Public Forums » archive » 3D subsript of 3D array from where function?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
3D subsript of 3D array from where function? [message #27513] Wed, 24 October 2001 08:47
a is currently offline  a
Messages: 4
Registered: July 1997
Junior Member
For a 3D array, the where function returns the 1D subscript. Can anyone show
me ho to return the full 3D subscript like

a = indgen(2,3,2)
print, a
0 1
2 3
4 5

6 7
8 9
10 11

print, where(a eq 10)
10

THis is the 1D subscript. I want it to return the 3D array [0,2,1]

I played with a being a 2D array and found I could get the 2D subscript with

a = indgen(2,3)
print, a
0 1
2 3
4 5

print, where(a eq 3)
3

sz = size(a,/DIM) & sizeX = sz[0] & sizeY = sz[1]
print, [where(a eq 3) mod sizeX, where(transpose(a) eq 3) mod sizeY]
1 1

(took me a while to figure out that transpose!)

The 3D case eludes me, however.
Thandk
[Message index]
 
Read Message
Previous Topic: Sparse support
Next Topic: Re: 3D subsript of 3D array from where function?

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

Current Time: Fri Oct 10 16:21:00 PDT 2025

Total time taken to generate the page: 2.64328 seconds