find position of a element in a matrix

4 次查看(过去 30 天)
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

采纳的回答

Walter Roberson
Walter Roberson 2011-11-22
find(A < 7,1,'last')
  3 个评论
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
How about a certain element in the matrix?

请先登录,再进行评论。

更多回答(1 个)

Honglei Chen
Honglei Chen 2011-11-22
You can use find
find(A<7,1,'last')
HTH
  2 个评论
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?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by