필터 지우기
필터 지우기

finding specific values' rows numbers in an array

조회 수: 1 (최근 30일)
sermet
sermet 2015년 6월 29일
편집: Guillaume 2015년 6월 29일
a=[11;4;3;99;5;6;7];
b=[4;7];
I need to find which rows in a matrix include 4,7. The answer must be 2th and 7th rows w.r.t. the solution.

채택된 답변

Guillaume
Guillaume 2015년 6월 29일
편집: Guillaume 2015년 6월 29일
Use the second return value of ismember:
[~, row] = ismember(b, a)
row will be 0 if the value in b is not found in a.

추가 답변 (1개)

Thorsten
Thorsten 2015년 6월 29일
편집: Thorsten 2015년 6월 29일
find(a==4)
find(a==7)
  댓글 수: 1
sermet
sermet 2015년 6월 29일
how can I adopt this solution as creating loop. Because arrays' rows are several hundreds.

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

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by