Finding row index in a matrix in which the sum of the elements is greater than 1
Show older comments
I have the following matrix:
S=[1,0,0;0,1,0;1,1,0;0,1,1;0,0,1]
I want to find row indexes in which the sum of the elements is greater than 1.
How can I do this?
Thanks
Accepted Answer
More Answers (1)
hello
here you are
S=[1,0,0;0,1,0;1,1,0;0,1,1;0,0,1]
row_sum = sum(S,2);
rw_ind = find(row_sum>1)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!