How to prevent Matlab from rounding off a column to zero?
조회 수: 3 (최근 30일)
이전 댓글 표시
I have a 10x2 matrix called I where the first column is just the integar index from 1:10, and the second column contains the actual values which happen to be of very small magnitude (~1e-8). Somehow if the matrix stores both the indexes (1:10) and the values, the values get all rounded off to zero. Only if I remove the index then Matlab can display the values properly without rounding off.
How to go about showing both the integar indexes column and a column of values of small magnitude?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/896090/image.png)
댓글 수: 0
채택된 답변
Matt J
2022년 2월 16일
You could use format long. Or, since it's just for display purposes, you can display it as a table,e g.
A=(1:5)';A=[A,1e10*A]
array2table(A)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!