主要内容

使用 fipref 设置 fi 对象显示预设项

您使用 fipref 对象来指定 fi 对象显示的三个方面:对象值、局部 fimath 属性和 numerictype 属性。

例如,以下代码显示具有局部 fimath 对象的 fi 对象的默认 fipref 显示:

a = fi(pi,'RoundingMethod','Floor','OverflowAction','Wrap')
a = 
    3.1415

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 13

        RoundingMethod: Floor
        OverflowAction: Wrap
           ProductMode: FullPrecision
               SumMode: FullPrecision

没有局部 fimath 的 fi 对象的默认 fipref 显示如下:

a = fi(pi)
a = 
    3.1416

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 13

接下来,更改 fipref 显示属性:

P = fipref;
P.NumberDisplay = 'bin';
P.NumericTypeDisplay = 'short';
P.FimathDisplay = 'none'
P = 
         NumberDisplay: 'bin'
    NumericTypeDisplay: 'short'
         FimathDisplay: 'none'
           LoggingMode: 'Off'
      DataTypeOverride: 'ForceOff'

a
a = 
0110010010001000
      numerictype(1,16,13)