E
E
Evgeny Petryaev2021-12-23 13:45:26
MATLAB
Evgeny Petryaev, 2021-12-23 13:45:26

Search for third place by max?

Let's say we have a vector like this:

A = [ 3 5 6 7 ]
second_max_value = max(A(A~=max(A)))

Finds the maximum and the second place, but how to find the 3rd place?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
U
Ustas4, 2021-12-24
@Gremlin92

B=Sort(A);
B(3)

U
U235U235, 2021-12-31
@U235U235

B = maxk(A,3)
See https://www.mathworks.com/help/matlab/ref/maxk.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question