Say I have the following basic if-statement:
if (A ~= 0)
% do something like divide your favorite number by A
else
% do something like return NaN or infinity
end
The problem is that A is not a simple number but a vector. Matlab returns true if no element in A is 0. What I am looking for is a vectorized? way of perforimg the if-statement above for each element in A.
Actually, I simply want to do this as fast as possible.