uitable in app designer: format scalar and size cell table
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (1)
dpb
el 22 de Jun. de 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 comentarios
dpb
el 22 de Jun. de 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.
Ver también
Categorías
Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!