Hi,,I am trying to calculate the weight of a matrix.how can i do that> I am explaining below

1 view (last 30 days)
Suppose I have a matrix...
A = [1 0 0 0 ;
1 1 0 0 ;
1 1 1 0 ;
1 1 1 1]
how do I calculate that how many coulmns have only one ONE ? TIA

Accepted Answer

the cyclist
the cyclist on 31 May 2016
numberOfColumnsThatHaveExactlyOneOne = sum(sum(A==1)==1);
  3 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!