主要内容

resetglobalfimath

将全局 fimath 设置为 MATLAB 出厂默认设置

语法

resetglobalfimath

说明

resetglobalfimath 在当前 MATLAB® 会话中将全局 fimath 设置为 MATLAB 出厂默认设置。MATLAB 出厂默认设置具有以下属性:

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

示例

在此示例中,您创建自己的 fimath 对象 F 并将其设置为全局 fimath。然后,使用 resetglobalfimath 命令,将全局 fimath 重置为 MATLAB 出厂默认设置。

F = fimath('RoundingMethod','Floor','OverflowAction','Wrap');
globalfimath(F);
F1 = fimath 
a = fi(pi) 

F1 =
 

        RoundingMethod: Floor
        OverflowAction: Wrap
           ProductMode: FullPrecision
               SumMode: FullPrecision
 
a =
 
    3.1416

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

现在,使用 resetglobalfimath 将全局 fimath 设置回出厂默认设置:

resetglobalfimath;
F2 = fimath 
a = fi(pi) 

F2 =
 

      RoundingMethod: Nearest
        OverflowAction: Saturate
           ProductMode: FullPrecision
               SumMode: FullPrecision 
a =
 
    3.1416

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

现在您已将当前 MATLAB 会话中的全局 fimath 设置回出厂默认设置。要在将来的 MATLAB 会话中使用全局 fimath 的出厂默认设置,您必须使用 removeglobalfimathpref 命令。

替代方法

reset(G) - 如果 G 是全局 fimath 的句柄,则 reset(G) 等效于使用 resetglobalfimath 命令。

版本历史记录

在 R2010a 中推出