Filter löschen
Filter löschen

uitable in app designer: format scalar and size cell table

8 Ansichten (letzte 30 Tage)
Luca Re
Luca Re am 21 Jun. 2023
Kommentiert: Luca Re am 22 Jun. 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

Antworten (1)

dpb
dpb am 22 Jun. 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 Kommentare
dpb
dpb am 22 Jun. 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 am 22 Jun. 2023
ok..i solve it removing the decimal numbers decimal

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by