[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where is the largest point ?


Take a peek at the MAX function (check the online help)

maxVal = Max(Arrat, maxIndex) 

maxVal will return the maximum value
maxIndex will return the index of the maximum value within the array. 
If there is more than one value qualifying as MAX, then only the index
of the first maxVal encountered is returned in maxIndex.


Guillaume Dargaud wrote:
> I'm still pretty basic at IDL and a lot of the _no loop_ concepts escape me
> entirely (I'm too used to C and such).
> If I have a 2D matrix, how do I find where is the maximum ?
> Say:
> Mat=FltArr(NbX, NbY)
> ...
> [Xmax, YMax] = Where( Mat eq Max(Mat) )
> or something like that ?
> --
> Guillaume Dargaud
> Colorado State University - Dept of Atmospheric Science
> http://rome.atmos.colostate.edu/
>   "If those folks in Kansas are right about evolution never having happened,
> I sure hope it happens soon."    - Michael Sheinbaum.

Ben Tupper
Bigelow Laboratory for Ocean Sciences
180 McKown Point Rd.
W. Boothbay Harbor, ME 04575