UITable in App Designer strips leading white space
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Felix Widmaier
le 10 Fév 2017
Commenté : Huzaifa
le 3 Déc 2025 à 10:40
When using uitable in GUIDE, I was able to pad strings with leading spaces to get them right aligned like in the following (using a monospace font):
1532.000
5.543
26.457
Currently I am considering switching to App Designer. I am using the same space-padded strings but here the uitable seems to strip them off. That is the result looks like the following:
1532.000
5.543
26.457
Is there a way to make uitable in App Designer keep the spaces like it did in GUIDE? Or even better, is there a way to directly right-align the strings without the need of padding?
1 commentaire
Huzaifa
le 3 Déc 2025 à 10:40
UITable in App Designer automatically trims leading spaces, which makes it difficult to display a blank message or text that begins with indentation. To preserve the visual spacing, you can replace normal spaces with non-breaking spaces (char(160)), since the table does not remove them. By inserting these non-breaking characters at the start of the string, the cell will appear to contain a blank message or properly indented content, while still behaving like standard text inside the UI.
Réponse acceptée
Plus de réponses (1)
Greg
le 27 Oct 2021
I encourage the use of proper horizontal-alignment-right as described in Felix's answer. However, in the event somebody has a real need for leading spaces (and apparently also consecutive interior spacing), use the unicode character 160. It is a special character designed to be blank/invisible but not classified as whitespace.
Example code:
text = ["Seafood";char(160+zeros(1,5)) + "Nachos"];
t = uitable(uigridlayout(uifigure,[1,1]),'Data',text);
1 commentaire
Usaid
le 4 Août 2022
Voir également
Catégories
En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!