Info

This question is closed. Reopen it to edit or answer.

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

1 view (last 30 days)
mayuresh
mayuresh on 25 Jul 2012
Closed: MATLAB Answer Bot on 20 Aug 2021
m-file

Answers (1)

Walter Roberson
Walter Roberson on 25 Jul 2012
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.

Community Treasure Hunt

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

Start Hunting!