save one matrix to another but with different precision

2 次查看(过去 30 天)
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?

回答(1 个)

James Tursa
James Tursa 2014-6-25
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:

类别

Help CenterFile Exchange 中查找有关 Numeric Types 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by