Azzera filtri
Azzera filtri

find position of a element in a matrix

3 visualizzazioni (ultimi 30 giorni)
NS
NS il 22 Nov 2011
Commentato: Farzana Aslam il 11 Gen 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 Commenti
Farzana Aslam
Farzana Aslam il 11 Gen 2022
how we find position from one matric to the other.

Accedi per commentare.

Risposta accettata

Walter Roberson
Walter Roberson il 22 Nov 2011
find(A < 7,1,'last')
  3 Commenti
Mohamed Aly
Mohamed Aly il 3 Giu 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 il 17 Lug 2020
How about a certain element in the matrix?

Accedi per commentare.

Più risposte (1)

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

Accedi per commentare.

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by