How to resize UI table to fill window?
40 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am outputting a UI table within matlab and it does not fill the entire window, I have to scroll over to see all the colums of data. I have tried to change the Units to "normalized" but that has not changed it. What else can I do?
Thank you for your help!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/983210/image.png)
Réponses (1)
Riccardo Scorretti
le 29 Avr 2022
Hi Logan,
setting Units to normalized is not enough: you have to modify also the property Position:
LastName = {'Sanchez';'Johnson';'Li';'Diaz';'Brown'};
Age = [38;43;38;40;49];
Smoker = logical([1;0;1;0;1]);
Height = [71;69;64;67;64];
Weight = [176;163;131;133;119];
BloodPressure = [124 93; 109 77; 125 83; 117 75; 122 80];
T = table(LastName,Age,Smoker,Height,Weight,BloodPressure)
fig = uifigure;
uit = uitable(fig, 'Data', T, 'units', 'Normalized', ...
'Position', [0 0 1 1]);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/983270/image.png)
1 commentaire
Riccardo Scorretti
le 29 Avr 2022
In this example, try to have a look to the properties of uit: you will discover a lot of ways of tweaking the appearence of the table:
>> uit
uit =
Table with properties:
Data: [5×6 table]
ColumnWidth: 'auto'
ColumnEditable: []
CellEditCallback: ''
Position: [0 0 1 1]
Units: 'normalized'
Show all properties
BackgroundColor: [2×3 double]
BeingDeleted: off
BusyAction: 'queue'
ButtonDownFcn: ''
CellEditCallback: ''
CellSelectionCallback: ''
Children: [0×0 handle]
ColumnEditable: []
ColumnFormat: {}
ColumnName: {6×1 cell}
ColumnSortable: []
ColumnWidth: 'auto'
ContextMenu: [0×0 GraphicsPlaceholder]
CreateFcn: ''
Data: [5×6 table]
DeleteFcn: ''
DisplayData: [5×6 table]
DisplayDataChangedFcn: ''
Enable: 'on'
Extent: [0 0 0.5357 0.7143]
FontAngle: 'normal'
FontName: 'Helvetica'
FontSize: 12
FontUnits: 'pixels'
FontWeight: 'normal'
ForegroundColor: [0 0 0]
HandleVisibility: 'on'
InnerPosition: [0 0 1 1]
Interruptible: on
KeyPressFcn: ''
KeyReleaseFcn: ''
Layout: [0×0 matlab.ui.layout.LayoutOptions]
Multiselect: on
OuterPosition: [0 0 1 1]
Parent: [1×1 Figure]
Position: [0 0 1 1]
RearrangeableColumns: off
RowName: {}
RowStriping: on
Selection: []
SelectionChangedFcn: ''
SelectionType: 'cell'
StyleConfigurations: [0×3 table]
Tag: ''
Tooltip: ''
Type: 'uitable'
Units: 'normalized'
UserData: []
Visible: on
By the way, never copy program codes as images: copy them at least as text, and preferably as code (by using the appropriate icon). You will get much more help; it is very nasty to have to rewrite codes by hand.
Voir également
Catégories
En savoir plus sur Develop uifigure-Based Apps dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!