format number column table/array
24 ビュー (過去 30 日間)
古いコメントを表示
just as an example, in Microsoft Excel, we can format any cell of spreadsheet or an entire column, chosing how many digits will appear after decimal point, or using comma separator.
I need to read my table without lots of digits after point in some columns, and other columns just entire part of number with comma separator.
I dont have doc generator package and dont need a word/pdf report.
If is possible to format columns in a simple array as well, I would like to know how.
Thanks!
回答 (1 件)
Walter Roberson
2023 年 11 月 8 日
MATLAB does not provide any way to customize how many digits are displayed for numeric arrays, other than 2 digits ( format bank ) or 5 digits in scientific notation ( format short e ) or 16 digits in scientific notation ( format long e )
MATLAB does not provide any method to customize how many digits are displayed for numeric arrays in uitable for traditional figures or for uifigure, other than the ability to chose a format on a per-column basis.
You cannot, for example, customize to say use non-scientific notation with 3 decimal places.
You can define formatting rules for your own class, https://www.mathworks.com/help/matlab/ref/matlab.mixin.customdisplay-class.html
Also, I am unclear at the moment about how much it is possible to do if you were to attach a uistyle to a uitable in a uifigure -- but as far as I have seen so far I have not seen a way to customize numeric display format using that approach.
2 件のコメント
Walter Roberson
2023 年 11 月 8 日
The usual work-around is to round() values to be put into a uitable . or to use compose to convert the numeric values into string arrays to be put into the uitable (possibly then converting them to categorical ) .
Do you need an editable uitable, so the user can modify the values in the interface, and the values the user puts in have to be forced to follow the formatting rules too?
参考
カテゴリ
Help Center および File Exchange で Maintain or Transition figure-Based Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!