Check to find if a row has an element occuring more than once
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Stephan
2019 年 5 月 12 日
編集済み: Stephan
2019 年 5 月 12 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!