How can I properly format small numbers using num2str?
显示 更早的评论
I was assigned to work on the aesthetics of a table that shows collected data as string.
I want to show the numbers with 4 digits percision, but whenever the number is bigger the 10e-5, the output will include all the zeros, and only the four digits, e.g:
x=0.000123456;
y=0.0000123456;
solx=num2str(x,'%.4G');
soly=num2str(y,'%.4G');
solx
soly
Is there any way that I can get solx to be formatted like soly?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Other Formats 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!