MATLAB: Function similar to isnan for zeros

isnanMATLAB

Is there a function that does what isnan does but with zeros?

Best Answer

The ~ operator
>> A=[1 0 2 3 0 0 4]
A =
1 0 2 3 0 0 4
>> nonzeroMap=~A
nonzeroMap =
0 1 0 0 1 1 0
Related Question