Effacer les filtres
Effacer les filtres

convert double to string!

1 132 vues (au cours des 30 derniers jours)
fatemeh
fatemeh le 29 Déc 2013
Commenté : Azzi Abdelmalek le 29 Déc 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?

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by