Matlab基本函数-format函数

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

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

2、用法说明

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

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

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

(3)format hex 十六进制表示

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

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

3、用法举例

>> pians =    3.1416>> format>> pians =    3.1416>> format short>> pians =    3.1416>> format long >> pians =   3.141592653589793>> format hex>> pians =   400921fb54442d18>> format bank>> pians =          3.14>> format rat>> pians =     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



           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow
这里写图片描述
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值