How to convert standard form to decimal notation?

I have a section of code that produces answers in standard form (i.e. 1.527000e+03 ) and would like it in normal decimal notation (i.e. 1527). I have tried things such as format long and format short, but these do not work. As well as this, I have attempted dividng the answer by 1000 but this still gives the number in standard form (1.527e00).
Any help would be appreciated!

回答 (2 件)

Jan
Jan 2021 年 2 月 5 日

1 投票

format long g

2 件のコメント

Oscar Zampi
Oscar Zampi 2021 年 2 月 5 日
Using this appears to work for some values, but some still are shown in standard form
Jan
Jan 2021 年 2 月 5 日
The long g format cannot display values like 1e61 oer 2e-38 in decimal notation. So please show some examples of values and explain, how you want to display them.
If you want a sprcific output, use frprintf instead of Matlab's automagical output.

サインインしてコメントする。

Walter Roberson
Walter Roberson 2021 年 2 月 5 日

0 投票

if they are all integers
int32(variable)
Or int64 for larger range

1 件のコメント

Oscar Zampi
Oscar Zampi 2021 年 2 月 5 日
This seems to give all outputs as 0

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeSimulink についてさらに検索

質問済み:

2021 年 2 月 5 日

コメント済み:

Jan
2021 年 2 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by