matlab matrix scientific notation

Hanmyo picture Hanmyo · Nov 10, 2010 · Viewed 16.7k times · Source

I've wondered about this for a while now. When Matlab prints the matrix A, for instance, with

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

Answer

Hanmyo picture Hanmyo · Nov 11, 2010

You can use:

format shortG

See format documentation for more details.