Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 工程数学软件 > MATLAB论坛
MATLAB论坛 一切MATLAB相关问题在此讨论。
回复
 
主题工具 显示模式
旧 2009-05-28, 15:10   #1
drosophilia
普通会员
 
注册日期: 2008-05-29
年龄: 46
帖子: 35
声望力: 17
drosophilia 正向着好的方向发展
默认 Matlab中的逻辑运算"&&"与"&","||"与"|"的区别

Matlab中的逻辑运算"&&"与"&","||"与"|"的区别是怎么样的?
drosophilia 当前离线   回复时引用此帖
旧 2009-05-29, 23:43   #2
TTT_IOU
普通会员
 
注册日期: 2009-02-22
帖子: 91
声望力: 18
TTT_IOU 正向着好的方向发展
默认 回复: Matlab中的逻辑运算"&&"与"&","||"与"|"的区别

& Element-wise Logical AND.
A & B is a matrix 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 the same dimensions (or one can
be a scalar).

&& 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.

| Element-wise Logical OR.
A | B is a matrix whose elements are logical 1 (TRUE) where either
A or B has a non-zero element, and logical 0 (FALSE) where both have
zero elements. A and B must have the same dimensions (or one can
be a scalar).

|| Short-Circuit Logical OR.
A || B is a scalar value that is the logical OR 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
1, then the entire expression evaluates to logical 1 (TRUE), regard-
less of the value of B. Under these circumstances, there is no need
to evaluate B because the result is already known.
望有帮助!!!
TTT_IOU 当前离线   回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码



所有时间均为北京时间。现在的时间是 14:09


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.