Avoiding scientific notation with Matlab

dynamic picture dynamic · Mar 20, 2013 · Viewed 16.6k times · Source

I have altready tried:

format long g;

But a number like this shows with scientific notation:

ans = 8.80173259769825e-05

How can I avoid scientific notation without using something like fprintf ?

Answer

bla picture bla · Mar 20, 2013

you can use:

sprintf('%.10f', yourNumber)

Or a more sophisticated option is to use Java-based formatting (see more info , credit to Yair Altman for showing this method), for example:

char(java.text.DecimalFormat('#.00000000').format(yourNumber));