Finding an array of numbers in an array

조회 수: 1 (최근 30일)
MiauMiau
MiauMiau 2018년 9월 30일
댓글: Star Strider 2018년 9월 30일
Hi
I have the attached coords_17 array, which is 2092 x 3 dimensional. Within this array, I want to find say the row which contains the coordinates [44, -30, 54]. However, the following commands fails somehow:
find(coords_17 == [44, -30, 54])
How can I find the relevant coordinates correctly? Many thanks

채택된 답변

Star Strider
Star Strider 2018년 9월 30일

I would use the ismember (link) function.

Try this:

target = [44, -30, 54];
Lidx = ismember(coords_17, target, 'rows');
row_number = find(Lidx)
row_number =
     2
  댓글 수: 4
MiauMiau
MiauMiau 2018년 9월 30일
thx
Star Strider
Star Strider 2018년 9월 30일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by