I need to find the length of an array for values > 0

1 visualización (últimos 30 días)
Cameron Bowyer
Cameron Bowyer el 12 de Sept. de 2021
Respondida: Chunru el 12 de Sept. de 2021
my array (called data) has values of 0 in it. I want to find the length of my array, exluding the 0 values.

Respuesta aceptada

Chunru
Chunru el 12 de Sept. de 2021
a = [1 2 0 3 -1 2 0];
n = sum(a~=0)
n = 5

Más respuestas (0)

Categorías

Más información sobre Cell Arrays en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by