How to find the number of ones in each column of a logical matrix?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Rightia Rollmann
am 11 Feb. 2017
Kommentiert: Star Strider
am 11 Feb. 2017
How to find the number of ones in each column of a logical matrix?
0 Kommentare
Akzeptierte Antwort
Star Strider
am 11 Feb. 2017
Bearbeitet: Star Strider
am 11 Feb. 2017
Use the sum function.
Example:
A = logical(randi([0 1], 10,5)); % Create Data
Ones_In_Each_Column = sum(A) % Sum The Columns
EDIT — Added ‘Example’ code.
4 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Particle & Nuclear Physics finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!