How can I properly format small numbers using num2str?
Show older comments
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?
Accepted Answer
More Answers (0)
Categories
Find more on Other Formats in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!