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

Home » Public Forums » archive » Re: WHERE - problem
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: WHERE - problem [message #33771] Wed, 29 January 2003 09:31 Go to previous message
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
Thomas Jordi wrote:
>
> thanks, it worked. however am I right, that the WHERE procedure is not
> able to handle the case, wehre you search values in a 3d array in one
> plane, and then want to acces with array[where] ?
>
> array(500,500,10)
> find=where(array(*,*,4) eq x)
>
> then the find-array with the subscripts indizes does not return the
> right values. it does it only at one or two dimensional arrays
> i thought, there must be a way like (array(find)) eg array(*,*,4(find))
> or whatever.
> So you cannot us the where for parts of the array only?

The deal here is, WHERE takes the explicitly specified dimension by
value, and analyzes the 2D array. If you look at the result of
WHERE(array[*, *, 4]) then you will see that the smallest index you can
get is 0, although you can't possibly want to use that zero and refer to
the entire Array. However, the following works:

find=where(array[*,*,4] eq x)
print, mean((array[*,*,4])[find])

or

s = size(array)
print, mean(array[find + 4*(s[1]*s[2])])

In the latter example, you do use Find to index Array, but you add the
size of the 3 ignored layers to Find, so the result is correct.
Hope this helps.
Cheers,
Pavel
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Simple overflow error
Next Topic: Re: Simple overflow error

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

Current Time: Fri Oct 10 06:44:47 PDT 2025

Total time taken to generate the page: 2.57561 seconds