I need to find the minimum value after the max has occurred. For example, in [1 5 7 3 2 6], the max is 7, and I would want to find 2.

 채택된 답변

Torsten
Torsten 2022년 9월 11일
편집: Torsten 2022년 9월 11일

0 개 추천

The first element of v which is a maximum is taken.
If the last element of v is the maximum, m will be empty.
v = [1 5 7 3 2 6];
[~,idx] = max(v);
m = min(v(idx(1)+1:end))

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

제품

릴리스

R2022a

태그

질문:

2022년 9월 11일

편집:

2022년 9월 11일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by