find position of a element in a matrix

2 visualizaciones (últimos 30 días)
NS
NS el 22 de Nov. de 2011
Comentada: Farzana Aslam el 11 de En. de 2022
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 comentarios
Ahmed Elgamal
Ahmed Elgamal el 8 de Dic. de 2016
parula.
Farzana Aslam
Farzana Aslam el 11 de En. de 2022
how we find position from one matric to the other.

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 22 de Nov. de 2011
find(A < 7,1,'last')
  3 comentarios
Mohamed Aly
Mohamed Aly el 3 de Jun. de 2019
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 el 17 de Jul. de 2020
How about a certain element in the matrix?

Iniciar sesión para comentar.

Más respuestas (1)

Honglei Chen
Honglei Chen el 22 de Nov. de 2011
You can use find
find(A<7,1,'last')
HTH
  2 comentarios
NS
NS el 22 de Nov. de 2011
thanks :)
Mohamed Aly
Mohamed Aly el 3 de Jun. de 2019
How about a certain element in the matrix? not necessarly the last one.
Would the same method applies for a 2D matrix?

Iniciar sesión para comentar.

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by