Find Common elements between any two columns in each matrix

4 次查看(过去 30 天)
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by