read actual matrix value without rounding off
Afficher commentaires plus anciens
I have computed a matrix that "seems" to have numbers with very high precision, for instance, the number 1.000 in the matrix below
However, when I try to read the number r(1,3), I got a number which is rounded off to 1 and I need it with full precision.
Is there a way to prevent this automatic rounding while reading the values of a matrix?
r =
0.0000 0.0000 1.0000
-0.9135 0.4067 0.0000
-0.4067 -0.9135 0.0000
>> r(1,1)
ans =
1.7006e-09
>> r(1,2)
ans =
3.9261e-10
>> r(1,3)
ans =
1
Réponses (1)
Steven Lord
le 14 Mai 2020
0 votes
Use the format function to change how the matrix is displayed. This does not change the values that are stored in the matrix, just how they are displayed.
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!