Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

How to make this a real number

Asked by kyin gab on 30 Nov 2012

Hello,

My MatLab code outputs this 1.3357e+03 and I think this can be converted to a number like 1335.7.

I would like the MatLab function that will help me convert it.

Thanks for your help.

0 Comments

kyin gab

Products

3 Answers

Answer by Azzi Abdelmalek on 30 Nov 2012
Accepted answer
 x=1.3357e+03;
 out=sprintf('%.1f',x)

1 Comment

kyin gab on 30 Nov 2012

Azzi, Matt, Walter Jurgen, thanks guys

Azzi Abdelmalek
Answer by Jurgen on 30 Nov 2012

sprintf?

0 Comments

Jurgen
Answer by Walter Roberson on 30 Nov 2012
format long g

1 Comment

Matt Fig on 30 Nov 2012

Even

format short g

gets it.

Walter Roberson

Contact us