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为浮点格式

FORMAT Set output format.

FORMAT with no inputs sets the ouput 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 SHORT E Floating point format with 5 digits.

      FORMAT LONG E  Floating point format with 15 digits for double and

                     7 digits for single.

      FORMAT SHORT G Best of fixed or floating point format with 5 digits.

      FORMAT LONG G  Best of fixed or floating point format with 15 digits

                     for double and 7 digits for single.

 

    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.

 

    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.14159265358979 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.

format——MATLAB的更多相关文章

  1. Transform the vot dataset into 4 corner format

    Transform the vot dataset into 4 corner format Matlab code to change the 8 value ground truth into 4 ...

  2. 如何将数据转换libsvm格式文件

    原文:http://blog.sina.com.cn/s/blog_5c2f929b0100qse8.html 有三种工具可用1.网上有一个xls文FormatDataLibsvm.xls具有宏命令, ...

  3. MATLAB读取一张RGB图片转成YUV格式

    1.读入照片 控制输出的标志定义 clc;close all;clear YES = 1; NO = 0; %YES表示输出该文件,请用户配置 yuv444_out_txt = 1; yuv444_o ...

  4. MATLAB曲面插值及交叉验证

    在离散数据的基础上补插连续函数,使得这条连续曲线通过全部给定的离散数据点.插值是离散函数逼近的重要方法,利用它可通过函数在有限个点处的取值状况,估算出函数在其他点处的近似值.曲面插值是对三维数据进行离 ...

  5. 【原创】开源Math.NET基础数学类库使用(03)C#解析Matlab的mat格式

                   本博客所有文章分类的总目录:[总目录]本博客博文总目录-实时更新  开源Math.NET基础数学类库使用总目录:[目录]开源Math.NET基础数学类库使用总目录 前言 ...

  6. Matlab的68个小常识

    1.det(A)可以计算矩阵A的行列式值.inv(A)可以计算矩阵A的逆 2.rref(A)可以将矩阵A化为行简化阶梯梯形矩阵 3.eps是系统定义的容许误差,eps=2.2204*10-16 4.p ...

  7. Matlab的部分文件操作

    Author:Maddock Date:2015-01-20 判断文件是否存在 infilename = [str,'\lena.jpg']; sgc_exist = exist(infilename ...

  8. MATLAB入门教程

    MATLAB入门教程   1.MATLAB的基本知识 1-1.基本运算与函数    在MATLAB下进行基本数学运算,只需将运算式直接打入提示号(>>)之後,并按入Enter键即可.例如: ...

  9. matlab basic operation command

    Matlab basic operation: >> 5+6 ans = 11 >> 3*4 ans = 12 >> 2^6 ans = 64 >> 1 ...

随机推荐

  1. Flex4+Spring3+Hibernate3+BlazeDS整合笔记

    普通Java Web工程流行使用ssh框架,而当前台使用Flex制作的时候,后台就不需要用Struts了,通过使用BlazeDS远程方法调用即可. 首先,新建Java Web工程,然后添加Flex项目 ...

  2. 基于css3的3D立方体旋转特效

    今天给大家分享一款基于css3的3D立方体旋转特效.这款特效适用浏览器:360.FireFox.Chrome.Safari.Opera.傲游.搜狗.世界之窗. 不支持IE8及以下浏览器.效果图如下 : ...

  3. 在window平台搭建Qt开发环境(使用VS2008 IDE)

    一直用QT Creator(mingw)开发Qt应用程序,每次如果需要修改编译链接参数选项时,都要修改pro文件,而这个文件是基于文本的,每次都要记住这些选项参数名,如果在知道原理的情况下还记住这些字 ...

  4. Sumdiv 等比数列求和

    Sumdiv Sumdiv Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 15364   Accepted: 3790 De ...

  5. PN-Traniger

        首先先从Bezier说起: 一条直线上有两个端点,P0和P1,那么直线可以写成 y = kx+b ,其实也就是P(t) = (1-t)P0 + P1 (这是个插值函数),(小注,我时常把这两个 ...

  6. c# 将文本中的数据快速导入到数据库(200万左右的数据量)

    1.sql2008中 list表,只有一个字段 Lvalue 2.文本大约256万的数据量 3.测试结果:用时36秒! string connStr = @"Data Source=.\SQ ...

  7. Oracle基础<1>--数据库设计

    一:为什么需要使用数据库设计 数据库设计可以使数据库通过健壮的数据库结构  高效并且健康  的进行工作. 二.数据库设计原则 (数据库设计.系统设计.架构设计) 1.熟悉需求 保证之后需求的变更 不会 ...

  8. input输入框,回车激活按钮事件代码

    <input type="text" name="输入框ID" id="输入框ID" onkeypress="if(even ...

  9. pyenv的安装和使用

    1. 先安装crul和git sudo apt-get install curl git-core 2. 安装pyenv curl https://raw.github.com/yyuu/pyenv- ...

  10. 关于ADO.NET 实体数据数据模型无法为Mysql 选择6.0 解决方案

    错误:您的项目引用了最新实体框架:但是,找不到数据链接所需的与版本兼容的实体框架数据库....... 图片: