필터 지우기
필터 지우기

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 CenterFile Exchange에서 Maintain 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