Find number in vector
27 ビュー (過去 30 日間)
古いコメントを表示
Let’s say I have this vector: A = [1,2,3,4,5,6] and I want to know when did my vector went above 3. Like I want to know the value that made my vector go above 3. So I’m interested in the value “4” not 5 or 6. Is there is a code that can help me ?
0 件のコメント
採用された回答
Jonas
2023 年 1 月 21 日
find(A>3,1)
1 件のコメント
Image Analyst
2023 年 1 月 21 日
This gives the index, not the value. To see the value, see my answer below where I give both the index and the value of the vector at that index.
その他の回答 (1 件)
Image Analyst
2023 年 1 月 21 日
Try this:
A = [1,2,3,40,50,60];
index = find(A > 3, 1, 'first')
theValueThere = A(index)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!