Using the command num2str
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
When I run:
num2str(5.7831e-04)
I get: '0.00057831'
How can I obtain '5.7831e-04' instead?
0 comentarios
Respuestas (1)
Ameer Hamza
el 11 de Nov. de 2020
Use sprintf()
sprintf('%.4e', 5.7831e-04)
3 comentarios
Ameer Hamza
el 11 de Nov. de 2020
Storing a number is not a matter of format. Inside memory, it will be saved as a double datatype with same bits. The format is only important if you want to print the number.
Ver también
Categorías
Más información sobre Workspace Variables and MAT Files 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!