read actual matrix value without rounding off
显示 更早的评论
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
回答(1 个)
Steven Lord
2020-5-14
0 个投票
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!