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

2 次查看(过去 30 天)
my array (called data) has values of 0 in it. I want to find the length of my array, exluding the 0 values.

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Cell Arrays 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by