Find the under condition min or max of a row vector

3 ビュー (過去 30 日間)
SOUGLES STAMATIS
SOUGLES STAMATIS 2021 年 1 月 11 日
コメント済み: KSSV 2021 年 1 月 11 日
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)
KSSV
KSSV 2021 年 1 月 11 日
find(~isnan(a),1,'first')
find(~isnan(a),1,'last')

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by