matlab中format是什么意思?

如题所述

format:设置输出格式

对浮点性变量,缺省为format short.

format并不影响matlab如何计算和存储变量的值。对浮点型变量的计算,即单精度或双精度,按合适的浮点精度进行,而不论变量是如何显示的。对整型变量采用整型数据。整型变量总是根据不同的类(class)以合适的数据位显示,例如,3位数字显示显示int8范围 -128:127。

format short, long不影响整型变量的显示。

format long 显示15位双精度,7为单精度(scaled fixed point)

format short 显示5位(scaled fixed point format with 5 digits)

format short eng 至少5位加3位指数

format long eng 16位加至少3位指数

format hex 十六进制

format bank 2个十进制位

format + 正、负或零

format rat 有理数近似

format short 缺省显示

format long g 对双精度,显示15位定点或浮点格式,对单精度,显示7位定点或浮点格式。

format short g 5位定点或浮点格式

format short e 5位浮点格式

format long e 双精度为15位浮点格式,单精度为7为浮点格式 

实例如图

温馨提示:答案为网友推荐,仅供参考