how to remove trailing zeros after rounding a matrix?
Show older comments
I need to round a matrix to two decimal places but I want to get rid of those trailing zeros after the decimal point. Even I want to use that matrix for plotting also? How to do it?
Answers (1)
format short
A = 1.23
format shortG
A = 1.23
5 Comments
Deepthi B
on 21 Apr 2021
Stephan
on 21 Apr 2021
There is no way to show it in workspace the way you want. Then you would have to use some dirty tricks such as save it as char or sym - but is it worth this only because of the trailing zeros?
Deepthi B
on 21 Apr 2021
Stephan
on 21 Apr 2021
Can you provide the code?
Deepthi B
on 21 Apr 2021
Categories
Find more on Numbers and Precision 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!