Function similar to isnan for 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

Or the not() command
>> nonzeroMap=not(A)
nonzeroMap =
0 1 0 0 1 1 0

Sign in to comment.

More Answers (0)

Categories

Products

Tags

Asked:

on 26 Feb 2015

Commented:

on 26 Feb 2015

Community Treasure Hunt

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

Start Hunting!