How to solve && operands to logical scalar

我是研究僧i 提交于 2019-11-28 12:17:21
user1083059

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?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!