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

Home » Public Forums » archive » using WHERE to search for multiple values
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
using WHERE to search for multiple values [message #30408] Thu, 25 April 2002 15:13 Go to next message
dmartin is currently offline  dmartin
Messages: 5
Registered: April 2002
Junior Member
I'm trying to do something like the following:

w=where(im eq val)

with im a byte array (say, 640x480)
and val an array (say, 10 to 40 long)

I want to find where im is equal to _any_ of the values in val. But,
val is not always the same size.

Is there a way to do this using one WHERE call? There seems to be a
giant time difference between:

for i=0,(size(val))[1]-1 do begin
w=where(im eq val(i))
...
endfor

and

w=where(im eq val(0) or val(1) or val(2) or ...)

(but I can't do the above since val has different sizes from call to
call)


Sorry for the run-on nature of this post.

Thanks,
Doug
Re: using WHERE to search for multiple values [message #30506 is a reply to message #30408] Mon, 29 April 2002 08:13 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Doug Martin wrote:
>
> I'm trying to do something like the following:
>
> w=where(im eq val)
>
> with im a byte array (say, 640x480)
> and val an array (say, 10 to 40 long)
>
> I want to find where im is equal to _any_ of the values in val. But,
> val is not always the same size.
>
> Is there a way to do this using one WHERE call? There seems to be a
> giant time difference between:
>
> for i=0,(size(val))[1]-1 do begin
> w=where(im eq val(i))
> ...
> endfor
>
> and
>
> w=where(im eq val(0) or val(1) or val(2) or ...)
>
> (but I can't do the above since val has different sizes from call to
> call)
>
> Sorry for the run-on nature of this post.
>
> Thanks,
> Doug


If you like to have something like this

; idx=which_indices([10,2,3,20,4,12],[10,20,30])
; print,idx
; 0 3


http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/which_indices.tar.gz

or you would like to have something like

PURPOSE:
; This function applies different boolean operators to two vectors.
; It's a wrapper for the functions a_and_b, a_or_b, a_xor_b, a_not_b
;
; CATEGORY:
; MATH
;
; CALLING SEQUENCE:
; Result = VekLogik(vec1, vec2)



http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/veklogik.tar.gz

For further routines have a look at
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml



regards

Reimar


--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
============================================================ =======
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL & Tomography
Next Topic: Re: color_quan(...., Cube=6) makes white white, but ...

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

Current Time: Wed Oct 08 18:14:15 PDT 2025

Total time taken to generate the page: 0.00528 seconds