フィルターのクリア

format number column table/array

24 ビュー (過去 30 日間)
Andre Carvalho
Andre Carvalho 2023 年 11 月 8 日
コメント済み: Andre Carvalho 2023 年 11 月 8 日
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 件のコメント
Andre Carvalho
Andre Carvalho 2023 年 11 月 8 日
it looks like the uitable solve these question.

サインインしてコメントする。

回答 (1 件)

Walter Roberson
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
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?
Andre Carvalho
Andre Carvalho 2023 年 11 月 8 日
First of all, Walter, thank you so much for the clear explanations!
About editable uitable, I dont need this. Anyway, in help documentation I saw a callback function example that update the uifigure when change the data.
Thanks again!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMaintain or Transition figure-Based Apps についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by