Afficher commentaires plus anciens
G=[1 0]with I={[1 0;1 1;0 0;1 0;1 1;0 1;1 0 random sequence]} i need to compare them and count number of matched bits
Réponses (2)
the cyclist
le 23 Juil 2011
0 votes
You can use the ismember() command, with the 'rows' option.
3 commentaires
mahaveer hanuman
le 23 Juil 2011
the cyclist
le 23 Juil 2011
Fangjun Jiang has kindly written the exact code you need. What's the problem?
Andrei Bobrov
le 23 Juil 2011
arrayfun(@(j1)isequal(I(j1,:),G),(1:size(I,1))')
Fangjun Jiang
le 23 Juil 2011
Probably there is no need to make I a cell array.
G=[1 0];
I=[1 0;1 1;0 0;1 0;1 1;0 1;1 0];
Compare=ismember(I,G,'rows');
Count=sum(Compare)
2 commentaires
mahaveer hanuman
le 23 Juil 2011
Fangjun Jiang
le 23 Juil 2011
Put in your G and I and follow the code. I've modified the code.
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!