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

Home » Public Forums » archive » Re: about MIN of 2D array
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: about MIN of 2D array [message #32714 is a reply to message #32713] Mon, 28 October 2002 13:58 Go to previous message
mchinand is currently offline  mchinand
Messages: 66
Registered: September 1996
Member
In article <apk9t5$6pr$1@dipsy.missouri.edu>,
Julia <julia65201@yahoo.com> wrote:
> hi, there,
>
> I have a queation about MIN.
>
> If I have a 2-dimension array, I want to get the value and position of
> minimum on each row. Is there a function in IDL can do this?
>
> Since for loop is not time efficient, so it is not suggested here.
>
> Any suggestion will be apprecaited.
>
> Regards,
>
> Julia
>
>

In IDL 5.5 you can do:

min_row=min(array,index,dimension=1)

min_row will contain the min of each row and index will give the index of
the min. The index value will be from 0 to number of elements in the
array. If you want the column number that contains the minimum value for
each row you can use:

row_index= index mod n_cols

where n_cols is the number of columns in your array.

Hope that helps,

--Mike


--
Michael Chinander
m-chinander@uchicago.edu
Department of Radiology
University of Chicago
[Message index]
 
Read Message
Read Message
Previous Topic: about MIN of 2D array
Next Topic: Re: Object Graphics Printing

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

Current Time: Tue Dec 02 11:33:34 PST 2025

Total time taken to generate the page: 0.87806 seconds