Direct link to this comment

And then in two days you will come back and ask why the code inside theif is not being executed....

For reasons ofcode clarity you should avoid using vector/matrix conditions withif,while, etc, and always use ascalar condition usingany,all,|| and&& as required. This will make your code easier to understand and less buggy.

etc, etc, etc. But luckily, as I wrote in my earlier comment, this confusion istrivial to avoid by simply only usingscalar conditions, and usingany,all,||, and&& as required, which make thecode intent perfectly clear. So you shouldnot swap&& for& as you have done, but explicitly addany orall as fits your logical conditions.

Direct link to this comment

Direct link to this comment

Yes, as Stephen saysyou did not solve the problem. You got rid of the error by introducing a subtler problem which only occurs under some circumstance because you didn't actually understand the cause of the problem.

Chances are you will come across the new problem 5 minutes before an important deadline.

If you really want to solve the problem then you need to tell us:

- was it intended thatm ori is a vector. If not, then that's the first bug you need to fix

- if it was intended, then you need to explain if theif applies when all the values are greater (or smaller) than the threshold or only some of them.

It's also very possible that theif is not even needed, depending on what you are doing.

This website uses cookies to improve your user experience, personalize content and ads, and analyze website traffic. By continuing to use this website, you consent to our use of cookies. Please see our Privacy Policy to learn more about cookies and how to change your settings.