How to find the position of the second largest value in a matrix in matlab a = [0.6149 1.0519 0.7874 0.9780] how to find the second largest number And find its position

How to find the position of the second largest value in a matrix in matlab a = [0.6149 1.0519 0.7874 0.9780] how to find the second largest number And find its position


For a very simple matrix, you can sort it directly with the sort function
For example:
[B,IX]=sort(a,'descend')
B =
1.0519 0.9780 0.7874 0.6149
IX =
2 4 3 1
B shows the value in descending order, IX shows the position of the value in B in the original vector, that is, the fourth bit is the second largest value



How to find the position of several elements in a matrix in MATLAB, such as the position of 2 5 binary elements


Let the matrix be a, then
find(A==2&A==5)
We can find out



Matlab finds out the position of the same element in the matrix
I have a column of numbers. How can I find out the position of the same elements in this column? For example, 92 of the following numbers are in positions 5, 6, 7 and 8
It must be solved by MATLAB
one hundred
ninety-seven
ninety-six
ninety-four
ninety-two
ninety-two
ninety-two
ninety-two
ninety-one
ninety-one
ninety
ninety
eighty-nine
eighty-nine
eighty-nine
eighty-eight
eighty-seven
eighty-six
eighty-six
eighty-four
eighty-four
eighty-four
eighty-three
seventy-nine
seventy-nine
seventy-seven
seventy-six


x=[100 97 96 94 92 92 92 92 91 91 90 90 89 89 89 88 87 86 86 84 84 84 83 79 79 77 76];
t = find(x == 92)
That's it