MATLAB Answers


how to use the compare signal in m-file (>/<)

Asked by mayuresh
on 25 Jul 2012




No products are associated with this question.

1 Answer

Answer by Walter Roberson
on 25 Jul 2012

See and

If you are comparing vectors or arrays, please be sure to note this behavior of if

An evaluated expression is true when the result is nonempty and contains all nonzero elements (logical or real numeric). Otherwise, the expression is false.

So when you have

if A < B

and A or B is a vector (or a matrix) then the "if" is only considered true if all A < B are true.


Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!