Can you use the 'format long' command in the 'fprintf' command?
Afficher commentaires plus anciens
I would like to have variable 'x' formated using the 'format long' command when it is printed using fprintf. However, I am unable to place it between the % and f values of ('%f',x) since 'format long' begins with an f. I have tried using '.15' between % and f, however, the output values are not aligned when the numbers infront of the decimal place increase (see below). Can 'format long' be used in fprintf? If not, how can I keep the numbers in front of the decimal place the same length (in this example, '08' for the last three entries)?
sqrt of a (x) error(e) iteration(s)
32.500000000000000 9.923e+02 1
17.234615384615385 2.330e+02 2
10.474036101145005 4.571e+01 3
8.292191785986859 4.760e+00 4
8.005147977880979 8.239e-02 5
8.000001655289593 2.648e-05 6
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Type Conversion dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!