uitable in app designer: format scalar and size cell table

11 次查看(过去 30 天)
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

回答(1 个)

dpb
dpb 2023-6-22
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 个评论
dpb
dpb 2023-6-22
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by