MATLAB Answers

Raldi
0

Function similar to isnan for zeros

Asked by Raldi
on 26 Feb 2015
Latest activity Commented on by Matt J
on 26 Feb 2015
Is there a function that does what isnan does but with zeros?

  0 Comments

Sign in to comment.

Tags

Products

1 Answer

Answer by Matt J
on 26 Feb 2015
Edited by Matt J
on 26 Feb 2015
 Accepted 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

  1 Comment

Matt J
on 26 Feb 2015
Or the not() command
>> nonzeroMap=not(A)
nonzeroMap =
0 1 0 0 1 1 0

Sign in to comment.