MATLAB: I have a mxn binary logical matrix . How to sum ones

column additionsmatrix arraymatrix manipulation

regards

Best Answer

sum(YourMatrix(:)) %grand total
sum(YourMatrix(:,[3 17 21]) %totals for columns 3, 17, 21