How many positive entries in array

I have a 1450x1 array. I want to count how many positive entries in array?

 采纳的回答

x = randn(1450,1);
indices = find(x>0);
length(indices)
or
count = length(nonzeros(x(x>0)));

更多回答(1 个)

hidayet beyhan
hidayet beyhan 2020-3-28
编辑:hidayet beyhan 2020-3-28
Or you can use for an array:
x = randn(1450,1);
sum(x>0)

类别

帮助中心File Exchange 中查找有关 Aerospace Blockset 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by