How do I shorten the amount of decimal spaces in a fprintf statement?
    2 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Matthew Olivo
 el 15 de En. de 2018
  
    
    
    
    
    Comentada: Star Strider
      
      
 el 15 de En. de 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 comentarios
Respuesta aceptada
Más respuestas (1)
  Star Strider
      
      
 el 15 de En. de 2018
        Use the format descriptor: '%.1f' to get one decimal place.
2 comentarios
Ver también
Categorías
				Más información sobre Multirate Signal Processing en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


