フィルターのクリア

How to define 4 digits after decimal

10 ビュー (過去 30 日間)
Mekala balaji
Mekala balaji 2018 年 7 月 31 日
編集済み: Walter Roberson 2020 年 6 月 22 日
Hi,
I have below data:
Input data (double):
2.4
3.5
45.44
2.023
I want to make them all in to its 4th digit after decimal
Desired output:
2.4000
3.5000
45.4400
2.0230
Can someone kindly help how make define or make it to 4 digits after decimal Many thanks in advance
  1 件のコメント
dpb
dpb 2018 年 7 月 31 日
num2str(x,'%.4f')

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

回答 (1 件)

Suraj Sudheer Menon
Suraj Sudheer Menon 2020 年 6 月 22 日
The data that is stored in a workspace can be in different formats.The short format displays decimal values upto 4 digits.
format short; % After executing this command all decimal values will be displayed upto 4 decimal values.
  1 件のコメント
Stephen23
Stephen23 2020 年 6 月 22 日
"The data that is stored in a workspace can be in different formats."
Numeric data classes do not store any format information. Number formatting is entirely a property of the displaying mechanism, and and is not stored anywhere as part of any number array in any workspace.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by