App designer Table with input numbers of rows and columns
14 ビュー (過去 30 日間)
古いコメントを表示
Alessandro Minali
2019 年 11 月 20 日
回答済み: Bhargavi Maganuru
2019 年 11 月 25 日
Hello!
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';
0 件のコメント
採用された回答
Bhargavi Maganuru
2019 年 11 月 25 日
You can create properties and set the values using following code
properties (Access = private)
Property % Description
colonna=3; %columns
slice=2; %rows
end
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';
end
end
Hope this helps!
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Develop uifigure-Based Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!