Check to find if a row has an element occuring more than once
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Stephan
il 12 Mag 2019
Modificato: Stephan
il 12 Mag 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical 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!