Finding the Indicies of the Max/Min in a Multidimensional Array In a 1-d array in IDL, the maximum or minumum value and the corresponding index can be found with the max() or min() functions. For example, IDL> a = dblarr(5) IDL> a[2] = 1.d IDL> amax = max(a,i) IDL> print,amax,i 1.0000000 2 For a multidimensional array max() and min() will still return the maximum and minimum values, but index i will be set as if the input array were "strung out" into one dimension. For example, IDL> a = dblarr(5,6,7) IDL> a[1,2,3] = -1.d IDL> amin = min(a,i) IDL> print,amin,i -1.0000000 101 I won't attempt to explain where "101" came from, but it is clearly not any of the indices in "a". The function array_indices(), however, can give us all three indices of the minimum element in "a". It takes as input the array of interest and the 1-d index, which in the above case was i = 101, and returns an array containing the multidimensional indices as shown below. IDL> iarr = array_indices(a,i) IDL> print,iarr,a[iarr[0],iarr[1],iarr[2]] 1 2 3 -1.0000000 There is much more information on max(), min(), and array_indices() in the IDL documentation.