Find the under condition min or max of a row vector

17 次查看(过去 30 天)
Assume that you have a row vector a = [ 1 3 5 2 5 7 8 3 6 4 9 ] . I want to find in which colomn there is the min value of this vector but under condition that this min value is >= 3 . Can enyone help?

采纳的回答

KSSV
KSSV 2021-1-11
a = [ 1 3 5 2 5 7 8 3 6 4 9 ] ;
a(a<3) = NaN ; % Replace values <3 to NaN
[val,idx] = min(a)
  5 个评论
SOUGLES STAMATIS
SOUGLES STAMATIS 2021-1-11
编辑:SOUGLES STAMATIS 2021-1-11
that returns the actual values ( 3 and 5 ). I need the column number ( 4 and 9 in this case)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by