Find Common elements between any two columns in each matrix
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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.
0 Commenti
Risposta accettata
Bruno Luong
il 16 Set 2019
Not sure but
keyNeuronMat1(1:10,1:4) & keyNeuronMat2(1:10,5:8)
Give you common neurons/groups.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!