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

New to MATLAB?

How to make this a real number

Asked by kyin gab

kyin gab (view profile)

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

kyin gab (view profile)

Products

3 Answers

Answer by Azzi Abdelmalek

Azzi Abdelmalek (view profile)

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

1 Comment

kyin gab

kyin gab (view profile)

on 30 Nov 2012

Azzi, Matt, Walter Jurgen, thanks guys

Azzi Abdelmalek

Azzi Abdelmalek (view profile)

Answer by Jurgen

Jurgen (view profile)

on 30 Nov 2012

sprintf?

0 Comments

Jurgen

Jurgen (view profile)

Answer by Walter Roberson

Walter Roberson (view profile)

on 30 Nov 2012
format long g

1 Comment

Matt Fig

Matt Fig (view profile)

on 30 Nov 2012

Even

format short g

gets it.

Walter Roberson

Walter Roberson (view profile)

Contact us