主要内容

定点数据视图

在定点设计器™软件中fipref对象的显示属性fi对象。代码示例通常显示fi对象fipref对象属性:

  • NumberDisplay- - - - - -“RealWorldValue”

  • NumericTypeDisplay- - - - - -'满的'

  • fimathdisplay.- - - - - -'满的'

设置“FimathDisplay”'满的'提供了一种快速而简单的方法来区分fi具有局部fmath的对象和与默认fmath关联的对象。当“FimathDisplay”被设置为'满的', MATLAB®显示fimath对象的属性fi与本地FIMATH的对象。Matlab永远不会显示fimath对象的属性fi与默认fmath关联的对象。由于这种显示差异,您可以告诉当fi对象仅通过查看输出就与默认的fimath关联。

此外,除非另有说明,整个Fixed-Point Designer文档中的示例使用以下fimath的默认配置:

RoundingMethod: Nearest OverflowAction: Saturate ProductMode: FullPrecision SumMode: FullPrecision

有关显示设置的更多信息,请参阅使用fipref设置fi对象显示参数

显示fi对象的fimath属性

要查看大多数定点设计器代码示例中的输出,请设置fipref属性,并创建两个fi对象:

p = fipref (“NumberDisplay”“RealWorldValue”...“NumericTypeDisplay”'满的'“FimathDisplay”'满的');一个= fi(π,“RoundingMethod”“地板”“OverflowAction”“包装”) b = fi(pi)

MATLAB返回如下结果:

a = 3.1415 DataTypeMode: Fixed-point: binary point scaling signedency: Signed WordLength: 16 FractionLength: 13 RoundingMethod: Floor OverflowAction: Wrap ProductMode: FullPrecision SumMode: FullPrecision b = 3.1415 DataTypeMode: Fixed-point: binary point scaling signedency: Signed WordLength: 16 FractionLength: 13

MATLAB显示fimath的输出中的对象属性fi对象一个因为一个有一个本地的五次方。

MATLAB不显示任何fimath的输出中的对象属性fi对象b因为b将自己与默认FIMATH相关联。

隐藏FI对象的FIMATH属性

如果你有多个fi对象,您可能想要关闭fimath对象显示:

  • NumberDisplay- - - - - -“RealWorldValue”

  • NumericTypeDisplay- - - - - -'满的'

  • fimathdisplay.- - - - - -“没有”

例如,

p = fipref (“NumberDisplay”“RealWorldValue”...“NumericTypeDisplay”'满的'“FimathDisplay”“没有”
p = NumberDisplay: 'RealWorldValue' NumericTypeDisplay: 'full' FimathDisplay: 'none' logingmode: 'Off' DataTypeOverride: 'ForceOff'
F = fimath (“RoundingMethod”“地板”“OverflowAction”“包装”);a = fi(, F)
a = 3.1415数据否示:固定点:二进制点缩放签名:签名WordLength:16 FractionLength:13

虽然这个设置有助于减少输出的数量,但它也使它不能从输出判断是否afi对象使用默认的fimath。为此,您可以使用isfimathlocal函数。例如,

isfimathlocal (a)
逻辑1

isfimathlocal函数返回1,fi对象具有一个局部五次数。如果函数返回0,fi对象使用默认的fimath。

缩短fi对象的数字类型显示

要进一步减少输出量,可以设置NumericTypeDisplay“短”.例如,

p = fipref (“NumberDisplay”“RealWorldValue”...“NumericTypeDisplay”“短”“FimathDisplay”'满的');一个= fi(π)
A = 3.1416数字类型(1,16,13)