Loren on the Art of MATLAB

Turn ideas into MATLAB


Loren on the Art of MATLAB has been archived and will not be updated.

Bottom Line on Logical

I just posted a blog on logical operator behavior in MATLAB and I want to be clear about the bottom line.

Use the newer MATLAB operators || and &&, in the context of expressions for if and while. The newer operators always short-circuit, not just in if and while expressions. The newer operators force you to be clear about your intention with respect to matrix expressions (including empty ones) and you choose how to reduce the array expressions to scalar ones that are unambiguous.

  • print


要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。