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

1 visualizzazione (ultimi 30 giorni)
my array (called data) has values of 0 in it. I want to find the length of my array, exluding the 0 values.

Risposta accettata

Chunru
Chunru il 12 Set 2021
a = [1 2 0 3 -1 2 0];
n = sum(a~=0)
n = 5

Più risposte (0)

Categorie

Scopri di più su Cell Arrays in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by