Borrar filtros
Borrar filtros

How to find the number of ones in each column of a logical matrix?

2 visualizaciones (últimos 30 días)
How to find the number of ones in each column of a logical matrix?

Respuesta aceptada

Star Strider
Star Strider el 11 de Feb. de 2017
Editada: Star Strider el 11 de Feb. de 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 comentarios

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Operating on Diagonal Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by