Question

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

Was it helpful?

Solution

You can use:

format shortG

See format documentation for more details.

OTHER TIPS

if you are usng fprintf you can use %f in the Format with also giving precession to the number of decimal Points you Need like %.2f which always give only two decimal number after decimal

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top