I am trying to find the 5th highest value of a two-dimensional matrix.
For ex)
t_1=rand(3,3)t_2=unique(t_1)t_3=maxk(t_2,5)
So I tried that but it gives me all the 5 values. I don't want all 5 in decreasing order till i get 5th highest. I just want 5th highest value. I thought of using this:
t_1=rand(3,3)t2=sort(t_1,'descend')t3=t2(5)
But this is only gonig to work if its 3by3. what if it was some big 5by5 or 7by7. I can't use that. It wont give me the fifth highest. or will it?
Best Answer