主要内容

isequivalent

确定两个 numerictype 对象是否具有等效属性

说明

y = isequivalent (T1, T2) 确定 numerictype 对象输入是否具有等效属性,并返回逻辑值 1 (true) 或 0 (false)。如果两个 numerictype 对象描述相同的数据类型,则它们是等效的。

示例

示例

全部折叠

使用 isequivalent 确定两个 numerictype 对象是否具有相同的数据类型。

T1 = numerictype(1, 16, 2^-12, 0)
T1 =


          DataTypeMode: Fixed-point: slope and bias scaling
            Signedness: Signed
            WordLength: 16
                 Slope: 2^-12
                  Bias: 0
T2 = numerictype(1, 16, 12)
T2 =


          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 12
isequivalent(T1,T2)
ans = logical
   1

尽管 T1T2 的数据类型模式不同,但函数返回 1 (true),因为这两个对象具有相同的数据类型。

输入参数

全部折叠

要比较的输入,指定为 numerictype 对象。

版本历史记录

在 R2014a 中推出

另请参阅

| |