find row index if all column elements are known

1 回表示 (過去 30 日間)
amit jha
amit jha 2019 年 8 月 18 日
編集済み: Bruno Luong 2019 年 8 月 18 日
I have a nx3 matrix. I need to find row index if i know all the column entries of a particular row. How to do it in a simple command.
Thanks,
Amit.

回答 (1 件)

Bruno Luong
Bruno Luong 2019 年 8 月 18 日
編集済み: Bruno Luong 2019 年 8 月 18 日
If A is your array, for example
A=ceil(10*rand(10000,3))
and you want to find [1,2,3] this command
find(ismember(A,[1 2 3],'rows'))
will return the row index(es) of matched data.

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by