How to find the number of ones in each column of a logical matrix?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Rightia Rollmann
il 11 Feb 2017
Commentato: Star Strider
il 11 Feb 2017
How to find the number of ones in each column of a logical matrix?
0 Commenti
Risposta accettata
Star Strider
il 11 Feb 2017
Modificato: Star Strider
il 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Operating on Diagonal Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!