Since you mentioned that there is no single value in the array which equals zero. And you specifically want to do some task when there is a zero crossing and other task when it does not. So I have included a sample script below:
% numZeroCross() will return the number of zero-crossing in the array
% passed as parameter
function times=numZeroCross(x)
len=length(x);
count=0;
for i=1:len-1
if((x(i)*x(i+1)) < 0)
disp('zero crossing');
%do something
count=count+1;
else
disp('not a zero crossing');
%do something
end
end
times=count;
end
For example the array has values:
arr = [80.6 120.8 -115.6 -76.1 131.3 105.1 138.4 -81.3-95.3 89.2 -154.1 121.4 -85.1 96.8 68.2]
Call the function from the command window : numZeroCross(arr)
Output will be 8.