Here is a simple example how to use java.text to format numbers using similar syntax to Excel's. # for a number or space, 0 for a number or zero, etc...
I found this useful for plots. I wanted the ability to have tic labels formatted with commas. Rather then writing my own, I use the ability to call java from matlab.
To utilize with plotting:
This works as is for my needs, but I welcome any suggestions for improvement.
Stephen Lienhard (2022). NumberFormatter (https://www.mathworks.com/matlabcentral/fileexchange/8361-numberformatter), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!