Display result with two decimal places

125 ビュー (過去 30 日間)
Felix Eckle
Felix Eckle 2021 年 7 月 16 日
コメント済み: Felix Eckle 2021 年 7 月 16 日
Hello guys,
my question seems stupid but I just can't figure it out. I have three results:
A=1.502357714661695e+04
B=1.096611470555982e+04
C=5.516017989036879e+03
Now I want to display then like:
A=15,023.58
B=10,966,14
C=5,516.02
I tried
format short g
but then the decimals are missing. I tried:
sprintf('%f',A);
but then I can't change the format to show "," and "." and I can't round the result.
Nothing else I tried worked. Any Idea of how to display the numbers correctly?
kind regards

採用された回答

Steven Lord
Steven Lord 2021 年 7 月 16 日
format bank
A=1.502357714661695e+04
A =
15023.58
B=1.096611470555982e+04
B =
10966.11
C=5.516017989036879e+03
C =
5516.02
  1 件のコメント
Felix Eckle
Felix Eckle 2021 年 7 月 16 日
Thank you so much!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by