フィルターのクリア

How to find the index in a row vector where a number exceeds a certain value?

1 回表示 (過去 30 日間)
I have a 1x600 row vector. The initial values are small and as we go towards the 200th element or so, the values start increasing. How can I find the exact index of the first element that exceeds a certain limit?
For example, I want to find the undex of the first element that exceeds the value of 50. In this case, it is the 187th element. How do I find that using a code?

採用された回答

Shubham Gupta
Shubham Gupta 2019 年 9 月 24 日
編集済み: Shubham Gupta 2019 年 9 月 24 日
Try :
A = 1:100;
lim = 50;
ind = find(A>lim,1); %% Here 1 after comma suggests the first element that is greater than 50
In the above case output should be ind = 51 For more info try
doc find
Hope this helps !
  1 件のコメント
Siddharth Gopujkar
Siddharth Gopujkar 2019 年 9 月 24 日
Worked perfectly! Thanks! I was missing the '1' for the first value.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by