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

Home » Public Forums » archive » Re: How to find second minimum elements in an array in IDL?
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: How to find second minimum elements in an array in IDL? [message #64676 is a reply to message #64675] Wed, 14 January 2009 07:31 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Hu writes:

> Supposing that there is an array X=[9,2,3,5,1,6,8,4,7], how can I find
> the first and second minimums (in this array are elements 1 and 2) in
> this vector?
>
> I use this to find the first minimum (element 1):
>
> index = where(X eq min(X))
> minimum_first=X[index]
>
> But, how can i find the elements 2 ?

Set the first minimum elements to some absurdly large
value and give it another try. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Transparency in object_graphics
Next Topic: question about array interpolation

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

Current Time: Wed Oct 08 15:49:41 PDT 2025

Total time taken to generate the page: 0.00502 seconds