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

Home » Public Forums » archive » where, or, and loops. There has to be a better way.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
where, or, and loops. There has to be a better way. [message #83474] Fri, 08 March 2013 15:47 Go to previous message
anniebryant@gmail.com is currently offline  anniebryant@gmail.com
Messages: 16
Registered: March 2009
Junior Member
Please see the below example to demonstrate my problem:

--------------------------------


; This is a large floating point array of river basins
huc = fltarr(4800,4800)

; IDs of the basins I want to extract
NEW = [1102,1103,1104,1105]

; Find where the basins are
pos = where(huc eq NEW[0] or $ ; IS THIS THE ONLY WAY TO FIND THE VALUES IN THE LARGER ARRAY??
huc eq NEW[1] or $
huc eq NEW[2] or $
huc eq NEW[3])

; Create new array and insert basins
key = intarr(4800,4800)

key(pos) = 1
---------------------------------

THe issue here is, what happens when the 'NEW' variable has 300 values in it? Do I have to go through 300 iterations of:

pos = where(huc eq NEW[1] or $
............... or $
huc eq NEW[299])


I hope someone has found a way around this.

Thanks for any ideas you can give!!!
Annie
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Majority Filter
Next Topic: Sorting a matrix

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

Current Time: Wed Oct 08 17:38:39 PDT 2025

Total time taken to generate the page: 0.00439 seconds