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

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

Asked by mayuresh on 25 Jul 2012

m-file

0 Comments

mayuresh

Products

No products are associated with this question.

1 Answer

Answer by Walter Roberson on 25 Jul 2012

See http://www.mathworks.com/help/techdoc/ref/lt.html and http://www.mathworks.com/help/techdoc/ref/gt.html

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.

0 Comments

Walter Roberson

Contact us