> I try to find out the 100 maximum elements in a 4D array and then I
> want to put the result in a 2D array, Which should show me the
> locations of the elements and the values of those elements
The easiest and most efficient will probably be to Reshape the 4D array
into a 1D array. Find the hundred largest elements in the 1D array,
then use the dimsizes to compute the 4D indices from the 1D index.
To find the maxes of a 1D array, you can either use Array Max/Min
repeatedly, and substitute -inf or something after each find, or you can
add the index number to a cluster with the original amplitude, then sort
and take the first one hundred elements -- the index tells you where
they came from in the array.
Too map back 1D to 4D, a 2x3x4x5 array has
120 elements (0-119) in 1D
form. Given a 1D index X, to turn it into a 4D index a, b, c, d, you
first divide X by 5, put the remainder in d, then divide the quotient by
4 and put the remainder in c, ... and place the final remainder in a.
Greg McKaskle