是平等的
确定阵列平等
Description
tf = is equal(
返回逻辑一个1,,,,一个2,...,An
)1
((true
)如果所有输入都是等效的。
Examples
Compare Two Numeric Matrices
创建两个数字矩阵并进行比较以保持平等。
a =零(3,3)+1e-20;b =零(3,3);tf = is equal(a,b)
tf =逻辑0
The function returns logical0
((错误的
) 因为the matrices differ by a very small amount and are notexactly等式ual.
比较两个结构
Create two structures and specify the fields in a different order.
一个= struct('field1',0.005,'field2',,,,2500); B = struct('field2',,,,2500,'field1',0.005);
比较平等的结构。
tf = is equal(a,b)
tf =逻辑1
Even though the ordering of the fields in each structure is different,是平等的
treats them as the same because the values are equal.
将数字值与特殊的非数值值进行比较
比较逻辑值true
to the double integer1
。
quequal(true,1)
ans =逻辑1
注意是平等的
测试平等时,不考虑数据类型。
同样,比较'一个'
to the ASCII-equivalent integer,65
。
是平等的('一个',,,,65)
ans =逻辑1
结果是合乎逻辑的1
((true
) 自从double('a')
等式uals65
。
比较包含NAN值的向量
创建包含NAN值的三个向量。
a1 = [1 nan nan];a2 = [1 nan nan];a3 = [1 nan nan];
Compare the vectors for equality.
tf = is equal(一个1,,,,一个2,A3)
tf =逻辑0
结果是合乎逻辑的0
((错误的
) 因为是平等的
does not treat NaN values as equal to each other.
Compare Two Datetime Values
确定2013年1月13日在阿拉斯加安克雷奇的午夜等于开罗的同一日期。
t1 = datetime(2013,1,13,0,0,0,'时区',,,,'America/Anchorage');t2 = datetime(2013,1,13,11,0,0,'时区',,,,'Africa/Cairo');tf = is equal(t1,t2)
tf =逻辑1
一个dd 8 months to the date, and compare the datetime values for equality.
T1 = DateTime(2013,9,13,0,0,0,'时区',,,,'America/Anchorage');T2 = DateTime(2013,9,13,11,0,0,'时区',,,,'Africa/Cairo');tf = is equal(t1,t2)
tf =逻辑0
DateTime值不再相等,因为开罗没有观察到日光节省时间。
比较字符向量与字符串标量
即使大小和数据类型不同,是平等的
返回逻辑1
((true
)when comparing a character vector and string scalar that contain the same sequence of characters.
是平等的("foo",,,,'foo')
ans =逻辑1
输入参数
一个,,,,b
-要比较的输入(作为单独的参数)
arrays
Inputs to be compared, specified as arrays.
In some cases, the types of the inputs do not have to match:
如果数字输入的大小相同,并且其内容具有相等的值,则它们是等效的。该测试分别比较了数字阵列的真实和虚构部分。
表,时间表,结构和单元阵列仅在所有元素和属性相等时才是等效的。
包含相同字符序列的字符串标量和字符矢量是等效的。
Some data type comparisons have special considerations involving metadata. If the inputs areall:
结构 - 只要内容物相等,字段就不必按相同的顺序。
顺序分类阵列 - 必须具有相同的类别集,包括其订单。
Categorical arrays that are not ordinal — Can have different sets of categories, and
是平等的
比较每对元素的类别名称。Datetime arrays —
是平等的
比较时间点时忽略显示格式。如果阵列全部与时区关联,则是平等的
比较时间而不是时钟时间(例如,01-May-2018 09:00:00 EDT
与01-May-2018 06:00:00 PDT
, 所以是平等的
返回true
即使时钟时间为9:00和6:00)。Objects —
是平等的
返回逻辑1
((true
)对于具有平等属性值的同一类的对象。
一个1,,,,一个2,...,An
-要比较的一系列输入(作为单独的参数)
arrays
要比较的一系列输入,指定为阵列。
In some cases, the types of the inputs do not have to match:
如果数字输入的大小相同,并且其内容具有相等的值,则它们是等效的。该测试分别比较了数字阵列的真实和虚构部分。
表,时间表,结构和单元阵列仅在所有元素和属性相等时才是等效的。
包含相同字符序列的字符串标量和字符矢量是等效的。
Some data type comparisons have special considerations involving metadata. If the inputs areall:
结构 - 只要内容物相等,字段就不必按相同的顺序。
顺序分类阵列 - 必须具有相同的类别集,包括其订单。
Categorical arrays that are not ordinal — Can have different sets of categories, and
是平等的
比较每对元素的类别名称。Datetime arrays —
是平等的
比较时间点时忽略显示格式。如果阵列全部与时区关联,则是平等的
比较时间而不是时钟时间(例如,01-May-2018 09:00:00 EDT
与01-May-2018 06:00:00 PDT
, 所以是平等的
返回true
即使时钟时间为9:00和6:00)。Objects —
是平等的
返回逻辑1
((true
)对于具有平等属性值的同一类的对象。
Tips
The equality of two function handles depends on how they are constructed. For more information, see比较功能句柄。
是平等的
返回逻辑0
((错误的
)对于具有动态属性的两个对象,即使属性具有相同的名称和值。是平等的
在测试两个对象以保持平等时,仅比较存储的(非依赖性)属性。When comparing two handle objects, use
==
测试对象是否具有相同的句柄。利用是平等的
确定两个具有不同手柄的对象是否具有相等的属性值。
扩展功能
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
GPU代码生成
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.
基于线程的环境
使用MATLAB®在后台运行代码backgroundPool
或使用并行计算工具箱加速代码™ThreadPool
。
此功能完全支持基于线程的环境。万博1manbetx有关更多信息,请参阅在基于线程的环境中运行MATLAB功能。
GPU数组
一个ccelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see在GPU上运行MATLAB功能(并行计算工具箱)。
分布式阵列
使用Parallel Computing Toolbox™,将群集组合内存的组合存储器划分。
This function fully supports distributed arrays. For more information, seeRun MATLAB Functions with Distributed Arrays(并行计算工具箱)。
版本历史记录
Open Example
你有改变了d version of this example. Do you want to open this example with your edits?
MATLABCommand
您单击了与此MATLAB命令相对应的链接:
通过在MATLAB命令窗口中输入该命令。Web浏览器不支持MATLAB命令。万博1manbetx
Select a Web Site
选择一个网站以获取可用的翻译内容,并查看本地事件和优惠。根据您的位置,我们建议您选择:。
You can also select a web site from the following list:
如何获得最佳网站性能
选择中国网站(中文或英语)以获得最佳场地性能。其他Mathworks乡村网站未针对您所在的访问进行优化。
一个mericas
- 一个mérica Latina((Español)
- Canada((English)
- United States((English)