MATLAB Answers

tombola

how to stop exponential notation, both in output and in variable editor

Asked by tombola
on 7 Dec 2011
Latest activity Commented on by Andrew Reibold
on 22 Aug 2014

Hi is there any way, preferably from code, to stop exponential notation.

So any figures I display, or look at in the variable editor, are always in the format 0.0000000234 etc never 2.34e-8

Thanks for any help,

Tom

  0 Comments

Products

No products are associated with this question.

2 Answers

Answer by Walter Roberson
on 7 Dec 2011
Edited by John Kelly
on 4 Jun 2014
 Accepted answer

For variables that you disp(), command

format long

or

format long g

For the variable editor, see these instructions: http://www.mathworks.com/help/matlab/matlab_prog/check-variable-scope-in-editor.html

  2 Comments

Titus Edelhofer
on 7 Dec 2011

Hi Walter,

but as far as I know the "g" option will still use exponential notation if you have many leading or trailing zeros, e.g. for the 2.34e-8 example of Tom...?

Titus

Andrew Reibold
on 22 Aug 2014

'format long g' helped me solve a similar issue. Thanks for sharing


Answer by Titus Edelhofer
on 7 Dec 2011

Hi Tom,

as far as I know there is no way to force MATLAB to always use fixed notion. For generating output you can use fprintf with %f to use fixed notion.

Titus

  0 Comments


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today