Why will GUIDE not allow me to make a table smaller than 4 by 2?

1 次查看(过去 30 天)
I am trying to add a table component to my GUI in GUIDE. I would like the table to have three rows and three columns. When I use Table Property Editor dialog to try to delete the last row, pressing 'OK' or 'Apply' will cause the fourth row to reappear.

采纳的回答

MathWorks Support Team
If you try to reduce the size of a UITABLE object in GUIDE to less than 4 rows or less than 1 column in either of the dimensions, GUIDE will not allow such a deletion, and the deleted dimensions will remain in the UITABLE object.
To work around this issue, follow the steps below:
First, right click on the table and click 'View Callbacks' -> 'CreateFcn'. In the table's CreateFcn code, add the following line:
% set the tables 'Data' property to a cell array of empty matrices.
% The size of the cell array determines the number of rows and columns in the table.
set(hObject, 'Data', cell(3));
If column and row headers are also being used, they must be set programmatically in the CreateFcn as well:
set(hObject, 'RowName', {'R1', 'R2', 'R3'}, 'ColumnName', {'C1', 'C2', 'C3'});

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品


版本

R2008a

Community Treasure Hunt

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

Start Hunting!

Translated by