1、format函数:控制输出、显示格式

2、用法说明

format 缺省格式,同short。Matlab中常用的显示格式有:

(1)format short表示5位近似定点数

(2)format long 15位近似定点数

(3)format hex 十六进制表示

(4)format bank 银行格式,固定元和分

(5)format rat 最小证书比例(分数)表示

3、用法举例

>> pi

ans =

3.1416

>> format

>> pi

ans =

3.1416

>> format short

>> pi

ans =

3.1416

>> format long

>> pi

ans =

3.141592653589793

>> format hex

>> pi

ans =

400921fb54442d18

>> format bank

>> pi

ans =

3.14

>> format rat

>> pi

ans =

355/113

4、附录

>> help format

format Set output format.

format with no inputs sets the output format to the default appropriate

for the class of the variable. For float variables, the default is

format SHORT.

format does not affect how MATLAB computations are done. Computations

on float variables, namely single or double, are done in appropriate

floating point precision, no matter how those variables are displayed.

Computations on integer variables are done natively in integer. Integer

variables are always displayed to the appropriate number of digits for

the class, for example, 3 digits to display the INT8 range -128:127.

format SHORT and LONG do not affect the display of integer variables.

format may be used to switch between different output display formats

of all float variables as follows:

format SHORT Scaled fixed point format with 5 digits.

format LONG Scaled fixed point format with 15 digits for double

and 7 digits for single.

format SHORTE Floating point format with 5 digits.

format LONGE Floating point format with 15 digits for double and

7 digits for single.

format SHORTG Best of fixed or floating point format with 5

digits.

format LONGG Best of fixed or floating point format with 15

digits for double and 7 digits for single.

format SHORTENG Engineering format that has at least 5 digits

and a power that is a multiple of three

format LONGENG Engineering format that has exactly 16 significant

digits and a power that is a multiple of three.

format may be used to switch between different output display formats

of all numeric variables as follows:

format HEX Hexadecimal format.

format + The symbols +, - and blank are printed

for positive, negative and zero elements.

Imaginary parts are ignored.

format BANK Fixed format for dollars and cents.

format RAT Approximation by ratio of small integers. Numbers

with a large numerator or large denominator are

replaced by *.

format may be used to affect the spacing in the display of all

variables as follows:

format COMPACT Suppresses extra line-feeds.

format LOOSE Puts the extra line-feeds back in.

Example:

format short, pi, single(pi)

displays both double and single pi with 5 digits as 3.1416 while

format long, pi, single(pi)

displays pi as 3.141592653589793 and single(pi) as 3.1415927.

format, intmax('uint64'), realmax

shows these values as 18446744073709551615 and 1.7977e+308 while

format hex, intmax('uint64'), realmax

shows them as ffffffffffffffff and 7fefffffffffffff respectively.

The HEX display corresponds to the internal representation of the value

and is not the same as the hexadecimal notation in the C programming

language.

See also disp, display, isnumeric, isfloat, isinteger.

Reference page in Help browser

doc format

format函数使用matlab,Matlab基本函数-format函数相关推荐

  1. format函数使用matlab,Matlab基本函数-format函数 | 学步园

    1.format函数:控制输出.显示格式 2.用法说明 format 缺省格式,同short.Matlab中常用的显示格式有: (1)format short表示5位近似定点数 (2)format l ...

  2. matlab中rat=1函数,matlab中的format rat是什么意思

    格式输出Format函数 Format函数用于制定字符串或数字的输出格式. 语法:x = Format (expression, fmt ) expression是所输出的内容.fmt是指输出的格式, ...

  3. Matlab基本函数-conj函数

    Matlab基本函数-conj函数 1.conj函数:用于计算复数的共轭值 2.用法说明:y=conj(x)函数计算复数x的共轭值.输出结果y的维数跟输入x的维数一致,返回值为:real(y)-i*i ...

  4. (转)Matlab基本函数-fix函数

    原 Matlab基本函数-fix函数 2013年11月10日 21:00:25 翱翔天地 阅读数 13325 版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处 ...

  5. matlab中help所有函数功能的英文翻译

    doc funname 在帮助浏览器中打开帮助文档 help funname 在命令窗口打开帮助文档 helpbrowser 直接打开帮助浏览器 lookfor funname 搜索某个关键字相关函数 ...

  6. matlab第一类修正贝塞尔函数,bessel(第一类修正贝塞尔函数)

    MATLAB提供了计算贝塞尔函数的函数,具体包来括:besselj - 第一类贝塞尔函数,或简称贝塞尔函数:bessely - 第二类贝塞尔函数,又称诺伊曼函数(Neumann . 对光纤中传播的电磁 ...

  7. Matlab通信仿真常用函数

    信源函数 randerr 产生比特误差样本 randint 产生均匀分布的随机整数矩阵 randsrc 根据给定的数字表产生随机矩阵 wgn 产生高斯白噪声 信号分析函数 biterr 计算比特误差数 ...

  8. MATLAB常用命令及函数大全(字母顺序)

    花了些时间把MATLAB的命令以及函数按照字母顺序列了一个清单,供大家参考.               A a       abs 绝对值.模.字符的ASCII码值        acos 反余弦  ...

  9. Matlab学习-图像处理工具箱函数

    本文转载自http://www.cnblogs.com/gtts/archive/2011/05/20/2052339.html 下列表格中除了个别函数外,其余函数都是图像处理工具箱提供的关于图像处理 ...

最新文章

  1. 实战:基于OpenCV实现偏斜文档校正
  2. SD-WAN部署:全球企业必须考虑的问题—Vecloud微云
  3. 第十六节:ES6新增的 Set 和 WeakSet 是什么东西?
  4. IIS7配置PHP 报错 对找不到的文件启用文件监视
  5. 织梦自定义表单地区联动类型不可用的解决办法
  6. java 高并发im_java高并发(四)并发编程与线程安全
  7. Java 异常处理的 20 个最佳实践,你知道几个?| CSDN 博文精选
  8. utilities(matlab)—— 合成数据(synthesis data)
  9. 解析中国天气网页面获取七日天气 (Java)
  10. Java多线程(7):JUC(下)
  11. 精益创业实战 - 第5章 开始实验
  12. 多步攻击场景构建和攻击链提取方法
  13. alanwang[GDOU] 直接插入排序法简单演示
  14. 用Origin将Fluent中的数据导出并绘制云图
  15. PHP7封装了str_ends_with, phper看了都说好
  16. Oracle查询表名注释及表字段注释
  17. 关于ModbusTCP通讯汇川PLC
  18. Nsca安装简单步骤
  19. 2020-05-12
  20. mysql association_MyBatis association的两种形式——MyBatis学习笔记之四

热门文章

  1. sklearn数据集操作API
  2. Jenkins X:基于Kubernetes的CI/CD平台
  3. win docker运行MySQL
  4. linux vim可视模式、末行模式、保存退出快捷操作
  5. Java 8大原子操作
  6. Scala函数式编程:偏函数
  7. spring aop环绕通知@Around
  8. 十道常见的MyBatis 面试题
  9. word2003的页码设置
  10. 位运算n=(n-1)快速统计二进制1的个数