convert double to string!

1,393 views (last 30 days)
fatemeh
fatemeh on 29 Dec 2013
Commented: Azzi Abdelmalek on 29 Dec 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?

Accepted Answer

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

Sign in to comment.

More Answers (0)

Categories

Find more on Characters and Strings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!