save one matrix to another but with different precision

2 visualizaciones (últimos 30 días)
Daniel Barzegar
Daniel Barzegar el 25 de Jun. de 2014
Respondida: James Tursa el 25 de Jun. de 2014
Hi all, i have a matrix which includes float numbers and i want to save it into a new one, but in the new matrix i want to have more digits (compared to the 1st matrix) after the dot - precision.
Any ideas?

Respuestas (1)

James Tursa
James Tursa el 25 de Jun. de 2014
MATLAB supports IEEE 64-bit double precision floating point numbers (the default for constant numeric) and IEEE 32-bit single precision floating point numbers. They are displayed on your screen according to the current display option in effect, but the display does not affect the underlying numbers themselves. If you want to increase the number of digits displayed, you can type this at the command prompt:
format long
If you want to go back to fewer digits printed, you can type this:
format short
If you actually want to increase the precision of the underlying numbers, you will need to use something other than double or single. E.g., vpa from the Symbolic Toolbox, or HPF from John D'Errico:

Categorías

Más información sobre Numeric Types en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by