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

1 vue (au cours des 30 derniers jours)
Cameron Bowyer
Cameron Bowyer le 12 Sep 2021
Réponse apportée : Chunru le 12 Sep 2021
my array (called data) has values of 0 in it. I want to find the length of my array, exluding the 0 values.

Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur Cell Arrays dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by