Hi Guys,
How do I find the last element in a increasing matrix that is less than a particular number. For example if my matrix is
A=[ 1 2 3 4 6 8 9]
And I want the last number that is less than 7. So I want to find the position of 6 and not any other number like 1,2,3,4.
Thanks, NS

2 件のコメント

Ahmed Elgamal
Ahmed Elgamal 2016 年 12 月 8 日
parula.
Farzana Aslam
Farzana Aslam 2022 年 1 月 11 日
how we find position from one matric to the other.

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

 採用された回答

Walter Roberson
Walter Roberson 2011 年 11 月 22 日

0 投票

find(A < 7,1,'last')

3 件のコメント

NS
NS 2011 年 11 月 22 日
thanks :)
Mohamed Aly
Mohamed Aly 2019 年 6 月 3 日
How about a certain element in the matrix? not necessarly the last one.
Would the same method applies for a 2D matrix?
Akashkumar Chovatiya
Akashkumar Chovatiya 2020 年 7 月 17 日
How about a certain element in the matrix?

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

その他の回答 (1 件)

Honglei Chen
Honglei Chen 2011 年 11 月 22 日

0 投票

You can use find
find(A<7,1,'last')
HTH

2 件のコメント

NS
NS 2011 年 11 月 22 日
thanks :)
Mohamed Aly
Mohamed Aly 2019 年 6 月 3 日
How about a certain element in the matrix? not necessarly the last one.
Would the same method applies for a 2D matrix?

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

カテゴリ

タグ

質問済み:

NS
2011 年 11 月 22 日

コメント済み:

2022 年 1 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by