MATLAB: Check if two variables are not equal to zero.

checking vector elementsMATLABvector

I have the vector e.g
A=10
B=4
C=0
D=4
V = [A,B,C,D]
How would I check if more than two values equal zero.

Best Answer

ind=find(V==0)
size(ind)
OR
sum(V(:)==0) %this will give the number of zeros