I'm trying to build a 100*100 table in appdesigner, exactly like uitable(figure,100,100) in Matlab command but in appdesigner I can not set the size of the table. I am in deep need of help to fix it.thanks
Asked
Active
Viewed 842 times
1 Answers
0
You can change the size of the table in the startupFcn callback of the figure.
% Initialize the table to have 100 rows and 100 columns
% Each Row-Column cell can also be initialized with real data
app.UITable.Data = cell( 100, 100);
% Specify the row and column names, 100 x 1 cell {'Col 1', 'Col 2', ... }
app.UITable.ColumnName = {};
app.UITable.RowName = {};

user69221
- 176
- 6
-
I set my table's size as you said but when I import data from excel which, its size is less than 100 other cells automatically removed, I want to have all cells, what shall I do?Thanks for your help. – Learner Sep 11 '20 at 08:57
-
I guess you need to specify the range of cells of the table when adding the imported data to it, something like app.UITable.Data( 1:10, 1:30) = your_data. @Learner – user69221 Sep 11 '20 at 14:15
-
What kind of error and what does your imported data look like? – user69221 Sep 11 '20 at 14:45
-
The following error occurred converting from table to cell: Conversion to cell from table is not possible.it's an excel file. – Learner Sep 11 '20 at 16:08
-
Sounds like you were using the readtable function to load excel. You could try to use importdata, the output of which can be assigned to the table using the method I mentioned above. – user69221 Sep 11 '20 at 16:56
-
I changed it, and I faced with this error: Conversion to cell from double is not possible. [name,path] = uigetfile(); address = fullfile(path,name); t = importdata(address); app.UITable.Data(1:20,1:20) = t; I have another problem:How can I active a cell(A1) and display it in lable component? – Learner Sep 11 '20 at 17:31
-
I am not sure I understand what you mean by active. But if you want to display the content of a cell that you click on in a label object, you could edit the CellSelection callback. The content of the current cell can be accessed as app.UITable.Data{ event.Indices(1), event.Indices(2)}. – user69221 Sep 11 '20 at 18:59
-
Not sure what you mean by it doesn't work? Was the content not showing in the label? If this is the case, you need to update the figure simply by adding 'drawnow;' after setting the label content. – user69221 Sep 14 '20 at 21:01
-
Yah, the content is not showing in the label. How can I add this? – Learner Sep 15 '20 at 03:51