Filter löschen
Filter löschen

How can I find the first row of a specific number in a matrix?

15 Ansichten (letzte 30 Tage)
Hello Matlab Users,
  • I have a A matrix:
  • A=[2 4;2 10;2 15;5 14;6 7;6 15;8 16;8 10] and I want to see the first row where I meet let's say "6"(which is the 5th row).Could you help me in solving that problem,please?

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 26 Mär. 2014
idx=find(any(A==6,2),1)

Weitere Antworten (1)

Joseph Cheng
Joseph Cheng am 26 Mär. 2014
you can use the find() function and search for when the first column in A contains "6".
  1 Kommentar
Rengin
Rengin am 26 Mär. 2014
Bearbeitet: Rengin am 26 Mär. 2014
I don't know how to use it for that specific problem. Could you write me suitable codes for it,please?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by