MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by tombola
on 7 Dec 2011

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

*No products are associated with this question.*

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

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