フィルターのクリア

How to prevent Matlab from rounding off a column to zero?

3 ビュー (過去 30 日間)
CL
CL 2022 年 2 月 16 日
回答済み: Matt J 2022 年 2 月 16 日
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?

採用された回答

Matt J
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]
A = 5×2
1.0e+10 * 0.0000 1.0000 0.0000 2.0000 0.0000 3.0000 0.0000 4.0000 0.0000 5.0000
array2table(A)
ans = 5×2 table
A1 A2 __ _____ 1 1e+10 2 2e+10 3 3e+10 4 4e+10 5 5e+10

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by