Check to find if a row has an element occuring more than once
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
altaf ahmed
am 12 Mai 2019
Bearbeitet: madhan ravi
am 13 Mai 2019
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 Kommentare
Akzeptierte Antwort
Stephan
am 12 Mai 2019
Bearbeitet: Stephan
am 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!