Function similar to isnan for zeros

138 visualizzazioni (ultimi 30 giorni)
Raldi
Raldi il 26 Feb 2015
Commentato: Matt J il 26 Feb 2015
Is there a function that does what isnan does but with zeros?

Risposta accettata

Matt J
Matt J il 26 Feb 2015
Modificato: Matt J il 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 Commento
Matt J
Matt J il 26 Feb 2015
Or the not() command
>> nonzeroMap=not(A)
nonzeroMap =
0 1 0 0 1 1 0

Accedi per commentare.

Più risposte (0)

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by