MATLAB: How to find the Nth high number in a matrix A

find max valeu matrix 5th nth arrayMATLAB

Hi guys,
I need to find the 5th high number of a matrix. Using the max() function I can only have the 1st one.
Thanks for helping!

Best Answer

As Iain suggested, sort is a great way to go, but as you mention that you have a matrix, you might want to sort every element of the matrix:
sorted = sort(values(:));
sorted(end-4)