MATLAB: Function to format number as currency

currencyformatjavaMATLABnumberformat

I would like to format the number as a $xxx,xxx,xxx.xx currency, what is the easiest way to do this?

Best Answer

Or using java:
% Formatting according to locale
j = java.text.NumberFormat.getCurrencyInstance();
j.format(1000.3243)
% Different currency
curr = java.util.Locale.US;
j = java.text.NumberFormat.getCurrencyInstance(curr);
j.format(1000.3243)