Format currency in a uitable in app designer

I have a table with a column that has dollar amounts with $ sign and commas. I have created the values as strings:
"$ 1,111,111"; "$ 2,222" so that the commas will line up. When I send this to a table in app designer it strips out the leading spaces between the dollar sign and the number:
$ 1,111,111
$ 2,222
What I want is
$ 1,111,111
$ 2,222
Any suggestions?

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 1 Mai 2025
Bearbeitet: Walter Roberson am 1 Mai 2025

0 Stimmen

You need to specify the uitable FontName property, supplying a fixed-width font.
Your current problem is that spaces in proportion-width fonts are very thin compared to other characters.
Note: there is no way to specify a font name on a per-column basis, only the entire uitable at a time

3 Kommentare

Thanks for the suggestion. However, it does not seem to have solved the problem. I set FontName to Courier, and still have the same problem:
I even set the Amount as an editable field and type in $ 2,222 and it still takes out the leading spaces between the $ and the number.
This is a problem in R2024b.
This problem is solved in R2025a Pre-release.
Thanks!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Instrument Control Toolbox finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by