Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

matlab matrix scientific notation

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

like image 311
Hanmyo Avatar asked Nov 10 '10 18:11

Hanmyo


People also ask

Can you use scientific notation in MATLAB?

Scientific notation For example, 1,400,000 can be written as 1.4 x 106. In MATLAB (and other programming languages) a convenient shorthand for this is 1.4e6. The diameter of a carbon nanotube is 5.2nm. Use scientific notation to enter this value in metres.

How do you stop exponential formatting in MATLAB?

you can use "format short g" command in the start of the code. I am a fresher in matlab but as far as i know it can help to get rid of e in the answer. Sign in to comment. Sign in to answer this question.

What does 1e 3 mean in MATLAB?

>> 1.0e+03. ans = 1000.


1 Answers

You can use:

format shortG

See format documentation for more details.

like image 82
Hanmyo Avatar answered Sep 21 '22 14:09

Hanmyo