フィルターのクリア

how to change decimal point place

2 ビュー (過去 30 日間)
Mohamed Turkmani
Mohamed Turkmani 2022 年 11 月 30 日
編集済み: Mohamed Turkmani 2022 年 12 月 8 日
hi, i have audio numbers that are printed as :
3.261505126953125 3.227813720703125
3.267242431640625 3.217407226562500
3.260345458984375 3.212432861328125
3.239776611328125 3.209808349609375
3.209960937500000 3.205841064453125
3.177581787109375 3.198425292968750
3.147857666015625 3.186126708984375
3.122009277343750 3.170928955078125 etc.
i want to change the decimal point for example for the first number to be 3,261,505,126 and the second number to be :3,227,813,720 without the decimal point and the other remaining numbers
my code that prints the values is:
[z,Fs] = audioread("mixed sound.wav");
z = z+3;
z;
  2 件のコメント
Dyuman Joshi
Dyuman Joshi 2022 年 11 月 30 日
However, you can do it if you are okay with a string output
z=3.261505126953125;
zstr=addComma(z*1e15)
zstr = '3,261,505,126,953,125'
%function taken from the same thread linked above
function numOut = addComma(numIn)
jf=java.text.DecimalFormat; % comma for thousands, three decimal places
numOut= char(jf.format(numIn)); % omit "char" if you want a string out
end
Mohamed Turkmani
Mohamed Turkmani 2022 年 12 月 8 日
thanks for the responce , what about just getting rid of the decimal point for example to get 3261505126953125
also if i want to reduce the other remaining numbers such as getting 3261505 only

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

回答 (1 件)

David Hill
David Hill 2022 年 11 月 30 日
I am not sure how your numbers are stored. Are they stored as character arrays or doubles?
a='3.261505126953125';
b=[a(1),',',a(3:5),',',a(6:8),',',a(9:11)]
b = '3,261,505,126'
  1 件のコメント
Mohamed Turkmani
Mohamed Turkmani 2022 年 12 月 8 日
編集済み: Mohamed Turkmani 2022 年 12 月 8 日
as doubles i think , what about just getting rid of the decimal point for example to get 3261505126953125
also if i want to reduce the other remaining numbers such as getting 3261505 only

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

カテゴリ

Help Center および File ExchangeAudio Processing Algorithm Design についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by