matlab matrix scientific notation
Asked Answered
V

2

14

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

Vitovitoria answered 10/11, 2010 at 18:39 Comment(0)
V
14

You can use:

format shortG

See format documentation for more details.

Vitovitoria answered 11/11, 2010 at 19:24 Comment(1)
I kept reading that as short6 and was about to complain that I was getting an error :PPrindle
A
0

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

Ameline answered 2/11, 2016 at 12:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.