Sorting a 2D wave

Hey all,

I have a 2D wave (for example, 10*10 2D wave) and want to calculate the mean value of the 20% elements which have the smallest value (for example, if I have 100 numbers totally in a wave, I want to sort them in increasing order and calculate the mean of the first 20 elements). It seems the sort function in Igor can only sort 1D wave, so how can I calculate the mean value of the 20% elements which have the smallest value in a 2D wave?

Thanks
If it's really such a simple case, you could use redimension to quickly turn the matrix into a 1D wave for sorting. Use Redimension/N=rowdim*coldim (in your example Redimension/N=100 2Dwave) and then use sorting.