简体   繁体   English

matlab矩阵科学记法

[英]matlab matrix scientific notation

I've wondered about this for a while now. 我现在已经想了一会儿。 When Matlab prints the matrix A, for instance, with 当Matlab打印矩阵A时,例如,用

A

it sometimes appears in scientific notation such as 它有时会出现在科学记数法中

A =

    1.0e+03 *

         0         0    0.0070    0.0080    0.0030    0.0010
         0    0.0030   -0.0460    0.0400   -0.0930    0.1800
    0.0010   -0.0530   -0.0140   -0.0620    0.0790   -1.2360
    0.0020    0.0009   -0.0032    0.0016    0.0023   -1.4180
    0.0070   -0.0000   -0.0006   -0.0000         0         0

Does anyone know how to make it print normal floating point numbers? 有谁知道如何打印正常的浮点数? I've tried format short, format long, format short e, format long e, but none of them work. 我已经尝试过格式短,格式长,格式短e,格式长e,但它们都不起作用。 Some switch the formatting so that the scientific notation is within individual entries, but really these numbers aren't that ridiculous to just print out... 有些人会切换格式化,以便科学记数法在单独的条目中,但实际上这些数字并不是那么荒谬,只是打印出来......

You can use: 您可以使用:

format shortG

See format documentation for more details. 有关详细信息,请参阅格式文档

如果您使用的是fprintf,您可以在格式中使用%f ,同时也允许您需要的小数点数,例如%。2f ,它在小数点后总是只给出两位小数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM