Filter löschen
Filter löschen

convert double to string!

1.132 Ansichten (letzte 30 Tage)
fatemeh
fatemeh am 29 Dez. 2013
Kommentiert: Azzi Abdelmalek am 29 Dez. 2013
I want convert double number like 0.222833 to string but when i using num2str the number convert to '0.22283' and sixth digit of number is removed ,can u help me to convert it to string?

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 29 Dez. 2013
a=0.222833
a=sprintf('%.6f',a)
  2 Kommentare
fatemeh
fatemeh am 29 Dez. 2013
thank you very much
Azzi Abdelmalek
Azzi Abdelmalek am 29 Dez. 2013
%or
b=sprintf('%.20f',a);
idx=regexp(b,'0+','start');
b(idx(end):end)=[]

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by