using fprintf to print same length values
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
How can I use fprintf to print values with the same length (the number of digits after the pointer is changing based on the number of digits before the pointer)?
0.00000000
30.0000248
360.000305
0 commentaires
Réponses (2)
Azzi Abdelmalek
le 30 Déc 2013
Modifié(e) : Azzi Abdelmalek
le 30 Déc 2013
b=360.000305
m=9 % fixed length
out=sprintf('%9.9f',b)
ii=numel(strfind(out,'.'))
out=out(1:m+ii)
8 commentaires
Voir également
Catégories
En savoir plus sur Get Started with MATLAB 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!