How can I have 'dropdown' in an individual cell of a table in App Designer ?

51 views (last 30 days)
with reference to this previous resolved question, I would like to apply a drop down list to a single cell of the table and not to the whole column.
Is it possible by using table or can you suggest a better implementation?
app.UITable.Data = {'female';'male';'male'}; % have 3 rows of gender information.
app.UITable.ColumnFormat = {{'male', 'female'}}; % have option cell array within ColumnFormat property to indicate the 1st column is using dropdown menus.
app.UITable.ColumnEditable = true;

Answers (2)

gaoyi guo
gaoyi guo on 24 Feb 2022
I have solved it perfectly! Please adopt my answer if it is helpful!
My version is 2021a.
I used the 'categorical' function:
fig = uifigure;
a = categorical({'Blue','Red'}); % define a categorical type of variable a
col1 = {a(1);200}; % the recipe is quote an element in a!!!!
col2 = [400;'x'];
tdata = table(col1,col2); % define a table using the above columns
uit = uitable(fig,'Data',tdata,'ColumnEditable',true);

Sahithi Kanumarlapudi
Sahithi Kanumarlapudi on 23 Feb 2021
'uidropdown' is normally used to create a dropdown in MATLAB. But, it's parent can only be 'Figure object (default) | Panel object | Tab object | ButtonGroup object | GridLayout object' as per the documentation here as of now.
Hope this helps!


Find more on Develop uifigure-Based Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!