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

Home » Public Forums » archive » Re: Finding a value in a array efficiently
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: Finding a value in a array efficiently [message #48348 is a reply to message #48342] Thu, 13 April 2006 16:00 Go to previous messageGo to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Thu, 13 Apr 2006 13:31:42 -0700, Wayne Landsman wrote:

> I was asked an apparently simple question -- what is the most efficient
> way in IDL to determine if a particular scalar value is in an array.
> The loop method is straightforward:
>
> found = 0
> for i=0,n-1 do begin
> if array[i] EQ value then begin
> found = 1
> goto, DONE
> endif
> endfor
> DONE:
>
> This ugly code will end the loop as soon as a match is found.
> A first attempt at vectorized code might be

As an aside, do you avoid using BREAK instead of goto for compatibility
with old IDL versions?

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Update Shared memory Structure
Next Topic: Free source code diagramming programs

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

Current Time: Wed Oct 08 13:07:15 PDT 2025

Total time taken to generate the page: 0.00391 seconds