Find Common elements between any two columns in each matrix

4 ビュー (過去 30 日間)
AR
AR 2019 年 9 月 16 日
コメント済み: AR 2019 年 9 月 16 日
I'm comparing two matrices: 'KeyNeuronMat1', 100x12 and 'KeyNeuronMat2', 100x9. Each row in the matrix represents a neuron # drawn from a 100 total neurons and each column represents a group # computed by different NN so if a neuron gets assigned to that group, it is given a value "1", else "0". For each column in 'KeyNeuronMat1' (sample below), I'd like to identify which neurons (row indicies)
>> keyNeuronMat1(1:10,1:4)
ans =
1 1 1 1
0 0 0 0
0 1 0 0
0 1 1 1
1 0 0 0
0 0 0 0
0 1 0 0
0 1 0 0
0 0 1 1
0 0 1 1
are in common within each of the groups (e.g. column indicies) in 'KeyNeuronMat2' without using a loop.
>> keyNeuronMat2(1:10,5:8)
ans =
1 0 0 0
1 1 1 1
0 1 0 0
0 0 0 0
1 0 0 0
0 0 0 0
0 0 1 0
0 0 0 0
1 0 0 0
0 0 0 0
Is this possible with bsxfun as I've read about this function being used for similar but was not sure.
I've attached my data.
Thanks for any advice.

採用された回答

Bruno Luong
Bruno Luong 2019 年 9 月 16 日
Not sure but
keyNeuronMat1(1:10,1:4) & keyNeuronMat2(1:10,5:8)
Give you common neurons/groups.
  1 件のコメント
AR
AR 2019 年 9 月 16 日
thanks. that works for now!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Parallel Server についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by