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

조회 수: 18 (최근 30일)
Rengin
Rengin 2014년 3월 26일
답변: Azzi Abdelmalek 2014년 3월 26일
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?

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 3월 26일
idx=find(any(A==6,2),1)

추가 답변 (1개)

Joseph Cheng
Joseph Cheng 2014년 3월 26일
you can use the find() function and search for when the first column in A contains "6".
  댓글 수: 1
Rengin
Rengin 2014년 3월 26일
편집: Rengin 2014년 3월 26일
I don't know how to use it for that specific problem. Could you write me suitable codes for it,please?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by