Azzera filtri
Azzera filtri

Check the matrix result

7 visualizzazioni (ultimi 30 giorni)
Light
Light il 6 Giu 2013
How can i check the entire matrix zero or not
M(sum)=0

Risposta accettata

Walter Roberson
Walter Roberson il 6 Giu 2013
~any(M(:))
will be true if M is entirely 0
I am not sure if your (sum) is intended to convey anything? Are you asking whether the sum over M is 0? If so then,
if ~sum(M(:))
Note, though, that this would be subject to round-off and cancellation problems; there are other techniques to use if you need to be concerned about those.

Più risposte (1)

Matt J
Matt J il 6 Giu 2013

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by