Moving Decimal Places to the right

18 views (last 30 days)
Joydeb Saha
Joydeb Saha on 29 Sep 2022
Commented: Jan on 29 Sep 2022
How can I get the number format as 1412701202.018284 for an exponent format data 1.412701202025964e+09. May be with sprintf "%.6f" or equivalent ? I need to do the task for a mat file I am attaching.
Rik on 29 Sep 2022
@Joydeb Saha You need to first respond to the question Jan raised: what is it you want? Do you want a char or a double as the output? In the first case you need sprintf, in the second case your question does not make sense, as that is just how the data is displayed, not the underlying data itself.
What exactly do you want to achieve?

Sign in to comment.

Accepted Answer

VBBV on 29 Sep 2022
Edited: VBBV on 29 Sep 2022
format long % format long option
ans = '1412701202.025964'
Jan on 29 Sep 2022
@Joydeb Saha: As said already, you can store the array in the shown format as CHAR array only:
S = sprintf('%6f\n', GTt)
If you want to store it numerically, the format has no meaning. Matlab stores value in the IEEE754 format and you cannot incfluence the location of the decimal point.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!