uitable in app designer: format scalar and size cell table

11 vues (au cours des 30 derniers jours)
Luca Re
Luca Re le 21 Juin 2023
Commenté : Luca Re le 22 Juin 2023
hi,
i need to resize the column of table (to use a fixed size)
and i need 1.2964e+04 =====> 129640
i try to use addstyle but i can't find solution

Réponses (1)

dpb
dpb le 22 Juin 2023
Well, without code to look at, it's hard to point out what may have done wrong -- a simple test here worked just fine...
p=[20 20 210 80];
hUIF=uifigure('Position',p);
hUIT=uitable(hUIF,'Position',p,'Data',[129640 pi],'ColumnName',{'x','y'},'ColumnWidth',{60 120});
hUIT.ColumnFormat={'short','long'};
Changing the 'ColumnWidth', 'ColumnFormat' properties modifies the table as expected. NOTA BENE: the formatting options aren't very extensive, one of the values recognized by the format function or just one of {'char','logical','numeric'}, ignoring the pop-up menu thingie. Unfortunately, as with the builtin table, setting a specific format string for a given variable/column isn't supported; to do that you'd have to display everything as text and use callback function to format and then display the value.
  6 commentaires
dpb
dpb le 22 Juin 2023
Are you still trying to use fixed width columns? If so, try either 'auto' of 'fit' for the numeric columns and see if that helps.
It is very difficult to compute the number of pixels to hold aribtrary number of characters given the variable nature of fonts, fontsize, etc., etc., etc., ... numbers with eights (8) or other wider characters in them will need more display space than a number of the same number of digits comprised of "not so wide" characters. Unless, of course, you revert to a fixed-width font.
Luca Re
Luca Re le 22 Juin 2023
ok..i solve it removing the decimal numbers decimal

Connectez-vous pour commenter.

Catégories

En savoir plus sur Develop Apps Using App Designer 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!

Translated by