zoukankan      html  css  js  c++  java
  • format——MATLAB

    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.



  • 相关阅读:
    BZOJ3585&3339mex——主席树
    BZOJ1926[Sdoi2010]粟粟的书架——二分答案+主席树
    BZOJ2662[BeiJing wc2012]冻结——分层图最短路
    BZOJ1433[ZJOI2009]假期的宿舍——二分图最大匹配
    BZOJ1087[SCOI2005]互不侵犯——状压DP
    BZOJ4808马——二分图最大独立集
    BZOJ3175[Tjoi2013]攻击装置——二分图最大独立集
    BZOJ3524[Poi2014]Couriers——主席树
    BZOJ4010[HNOI2015]菜肴制作——拓扑排序+堆
    BZOJ2588Count on a tree——LCA+主席树
  • 原文地址:https://www.cnblogs.com/acmwangpeng/p/5524907.html
Copyright © 2011-2022 走看看