How can I find a number from a matrix, which is greater than and closest to 1.

3 vues (au cours des 30 derniers jours)
How can I find a number from a matrix, which is greater than and closest to 1. As I showed in attached table as an example. I know about indexing that just specifying the row and coloum I can find, however, if I have a huge matrix and I need to find this number and its row and coloumn than how can I find using find command etc. Thanks in advance.

Réponse acceptée

KALYAN ACHARJYA
KALYAN ACHARJYA le 21 Nov 2021
Modifié(e) : KALYAN ACHARJYA le 21 Nov 2021
Hints: Use logical indexing
  1. Get the data those are greater than 1: mat>1
  2. Subtract 1 from all elements of the matrix - mat-1
  3. Get the min one - min(mat)

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by