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 Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by