Here is a 10x10 array arr
.
This arr
has 100 elements. And it has distribution from -10 to 10 and there are 5 0-value.
I did this code because I wanted to know the number of 0.
count = 0;
for i = 1: 10
for j = 1: 10
if (arr (i, j) == 0)
count = count +1;
end
end
end
Logically, count
should be 5 in MATLAB's workspace. and i
and j
are 10.
However, when I run the code, count
is 0.
This code can not count the numbers.
How can I count the numbers?