How can I add DropDown Menus in multiple Cells of a particular Column in a UITable in App Designer?

13 次查看(过去 30 天)
I was able to populate the data into the UITable, but I want to make a column editible by placing a dropdown in a cell with three options/items within the dropdown and the amount of data within the UITable varies. I don't want to make multiple app.___DropDown to be inserted in each cell, but the same app component within each cell. I don't know if it's possble, but please let me know or if there is a UITable property that makes the cells of particular column in DropDown menus without having to do anything super complex.

采纳的回答

Voss
Voss 2023-8-22
Yes, you can set the ColumnFormat of that column to a cell array containing the dropdown items. The same items will appear in all dropdowns in that column of the uitable.
For example:
col_format = {'numeric' {'Yes' 'No'} 'numeric'};
data = {1 'Yes' 3; 11 'No' 6.5; 7.77 'No' 9; 10 'Yes' 12.13};
t = uitable( ...
'Data',data, ...
'ColumnFormat',col_format, ...
'ColumnEditable',true(1,size(data,2)));
  3 个评论
Sean
Sean 2023-8-23
I was able to figure it out, thank you for your help.
app.UITable.ColumnFormat = {'numeric' {'yes' 'no' 'maybe'} 'logical'};
Thank you!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by