MATLAB Answers

App designer Table with input numbers of rows and columns

36 views (last 30 days)
I want to create a table with the numbers of rows and columns previously requested to the user.
(the number of columns is given by app.colonna and the number of rows is given by app.slice)
In every cell I need a checkbox.
How can i create this table?
fig = uifigure;
tdata = table([false; false; false]);
uit = uitable(fig,'Data',tdata);
uit.Position(3) = 130;
uit.RowName = 'numbered';


Sign in to comment.

Accepted Answer

Bhargavi Maganuru
Bhargavi Maganuru on 25 Nov 2019
You can create properties and set the values using following code
properties (Access = private)
Property % Description
colonna=3; %columns
slice=2; %rows
You can use following code to create table with the given number of rows and columns and with check boxes in each row.
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
fig = uifigure;
tdata = table('Size',[app.slice, app.colonna],'VariableTypes',["logical","string","string"]); % use “logical” to get checkbox in first column
uit = uitable(fig,'Data',tdata,'ColumnEditable',[true false false]); % columns can be editable if ColumnEditable is true
uit.Position(3) = 130;
uit.RowName = 'numbered';
Hope this helps!


Sign in to comment.

More Answers (0)

Sign in to answer this question.




Translated by