Change Values of array to zero
古いコメントを表示
Hey guys wondering is anybody can help me out here. I have this array that prints this out:
0.6366, 0.0000, -0.2122, -0.0000, 0.1273
Which is fine.
But when I print it to a table using
set(handles.Table1, 'Data', cnarray);
It give me this:
0.6366, 3.8982e-17, -0.2122, -3.8982e-17, 0.1273
How could i fix this? I want those really low numbers to be zero. They are zero in the array when i print it out but not when i put it in a table. Help
採用された回答
その他の回答 (1 件)
Steven Lord
2016 年 10 月 26 日
Use logical indexing to force those small values to be exactly 0.
A = [-1 -0.5 -1e-10 0.5 0 2 1e-6]
A(abs(A) <= 0.1) = 0
カテゴリ
ヘルプ センター および File Exchange で Whos についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!