Minimum and Maximum after maximum value

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Mathematics and Optimization 的更多信息

标签

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by