I have a mxn binary logical matrix . How can I sum ones?

 Accepted Answer

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

More Answers (0)

Categories

Asked:

vin
on 9 Apr 2016

Edited:

vin
on 15 Apr 2016

Community Treasure Hunt

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

Start Hunting!