matlab的& 和&&

1、之前总是有matlab的提示,说要替换,也没有怎么去分析,可以参考一下

https://blog.csdn.net/qq_43571677/article/details/104765771###

2、可以看matlab的英文解释

& Element-wise Logical AND.
A & B is an array whose elements are logical 1 (TRUE) where both A
and B have non-zero elements, and logical 0 (FALSE) where either has
a zero element. A and B must have compatible sizes. In the simplest
cases, they can be the same size or one can be a scalar. Two inputs
have compatible sizes if, for every dimension, the dimension sizes of
the inputs are either the same or one of them is 1.

&& Short-Circuit Logical AND.
A && B is a scalar value that is the logical AND of scalar A and B.
This is a “short-circuit” operation in that MATLAB evaluates B only
if the result is not fully determined by A. For example, if A equals
0, then the entire expression evaluates to logical 0 (FALSE), regard-
less of the value of B. Under these circumstances, there is no need
to evaluate B because the result is already known.

3、总结一下:&是针对array的(vector or matrix等);&& 是针对标量的,是两个数 比较大小,后面的中文翻译是 “短路逻辑”

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值