Check to find if a row has an element occuring more than once
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I need to find if a row has more than one occurence of 1s. I am expecting a response return like true or false. Sample row matrix is below:
0 0 1 1 0 0
0 commentaires
Réponse acceptée
Stephan
le 12 Mai 2019
Modifié(e) : Stephan
le 12 Mai 2019
A = [0 0 1 1 0 0; 0 0 0 0 0 1; 1 1 0 0 0 1]
res = (sum(A==1,2)>1)
This works row-wise for more than 1 rows
4 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!