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

1 回表示 (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2012 年 12 月 17 日
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
MathWorks Support Team 2012 年 12 月 17 日
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 Center および File ExchangeMigrate GUIDE Apps についてさらに検索

製品


リリース

R2008a

Community Treasure Hunt

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

Start Hunting!

Translated by