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

Home » Public Forums » archive » WHERE problems (longish)
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 #69612 is a reply to message #35914] Thu, 04 February 2010 08:20 Go to previous messageGo to previous message
JJ is currently offline  JJ
Messages: 36
Registered: January 2007
Member
The value_locate() solution may work for you, but it will really only
work in pretty specific cases. The X vector must be monotonically
increasing (though you could first sort the list). Even if the values
you're looking for are not in X, a valid result will be returned -
since value_locate() returns the index of the start of the "interval
into which the given value falls" (this issue addressed by wox).

If you want a simple and robust solution to this kind of problem (and
many others), I highly recommend Craig Markwardt's cmset_op routine
(follow the Array/Set link from the Markwardt IDL Library page at
http://www.physics.wisc.edu/~craigm/idl/idl.html).

With cmset_op you would do something like:

index = cmset_op (x, 'and', y, /index)

Of course, if there are multiple entries in your array that have the
same value, and you want to find the indices of all of those
locations, you might want to do a where on each element of y.

-JJ
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: questions onn symbol and fonts
Next Topic: File Delete -- Friggin A!!

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

Current Time: Thu Oct 09 22:29:14 PDT 2025

Total time taken to generate the page: 0.24262 seconds