format number column table/array
24 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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!
Antworten (1)
Walter Roberson
am 8 Nov. 2023
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 Kommentare
Walter Roberson
am 8 Nov. 2023
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?
Siehe auch
Kategorien
Mehr zu Maintain or Transition figure-Based Apps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!