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

New to MATLAB?

Check the matrix result

Asked by Light

Light (view profile)

on 6 Jun 2013

How can i check the entire matrix zero or not

M(sum)=0

0 Comments

Light

Light (view profile)

Products

No products are associated with this question.

2 Answers

Answer by Walter Roberson

Walter Roberson (view profile)

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

Walter Roberson (view profile)

Answer by Matt J

Matt J (view profile)

on 6 Jun 2013
 any(M(:))

0 Comments

Matt J

Matt J (view profile)

Contact us