Minimum and Maximum after maximum value

1 回表示 (過去 30 日間)
jason
jason 2022 年 9 月 11 日
編集済み: Torsten 2022 年 9 月 11 日
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 日
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 件)

カテゴリ

Help Center および File ExchangeOperating on Diagonal Matrices についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by