Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Check the matrix result

Asked by Light on 6 Jun 2013

How can i check the entire matrix zero or not

M(sum)=0

0 Comments

Light

Products

No products are associated with this question.

2 Answers

Answer by Walter Roberson on 6 Jun 2013
Accepted answer
~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.

0 Comments

Walter Roberson
Answer by Matt J on 6 Jun 2013
 any(M(:))

0 Comments

Matt J

Contact us