Re: about MIN of 2D array [message #32713] |
Mon, 28 October 2002 16:20  |
Julia
Messages: 11 Registered: July 2002
|
Junior Member |
|
|
Thank you so much. It works!!!
Besides, can it be done in IDL5.4?
Regards,
Julia
"Mike Chinander" <mchinand@midway.uchicago.edu> wrote in message
news:Bqiv9.43$P4.10093@news.uchicago.edu...
> 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
|
|
|