How do I shorten the amount of decimal spaces in a fprintf statement?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Matthew Olivo
le 15 Jan 2018
Commenté : Star Strider
le 15 Jan 2018
I type in:
fprintf('The final student score is %f\n',round(final_points,1))
and the answer it gives me is:
The final student score is 690.200000
I need this to be shortened to 690.2, but cant figure out how. Please and thank you!
0 commentaires
Réponse acceptée
Plus de réponses (1)
Star Strider
le 15 Jan 2018
Use the format descriptor: '%.1f' to get one decimal place.
2 commentaires
Voir également
Catégories
En savoir plus sur Multirate Signal Processing 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!