matlab – How to solve && operands to logical scalar

matlab – How to solve && operands to logical scalar

If dIx and dIy are matrices (as opposed to 1-D vectors), max(dIx) and max(dIy) will return vectors.

&& and || should be used to compare scalars, not vectors.

You probably want to type

if max(dIx(:))<=103 && max(dIy(:))<=100

but I cannot tell for sure, as I dont know what the code is supposed to do 🙂

Use & and | for matrixes instead of &&, || .

&& and || are short circuit operators. If you think about it, they make no sense for matrixes. For example, the short circuit or – || stops and returns true whenever the first argument is true.
But how would you extend that to a matrix?

matlab – How to solve && operands to logical scalar

Leave a Reply

Your email address will not be published.