Function similar to isnan for zeros

107 views (last 30 days)
Raldi
Raldi on 26 Feb 2015
Commented: Matt J on 26 Feb 2015
Is there a function that does what isnan does but with zeros?

Accepted Answer

Matt J
Matt J on 26 Feb 2015
Edited: Matt J on 26 Feb 2015
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
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.

More Answers (0)

Categories

Find more on Data Type Identification in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!