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

1 visualizzazione (ultimi 30 giorni)
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.

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 17 Dic 2012
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'});

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Prodotti


Release

R2008a

Community Treasure Hunt

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

Start Hunting!

Translated by