How can I add a drop-down menu for a certain column in a UItable in App Designer?

28 views (last 30 days)
I read data from excel file using readtable command as follows:
app.data=readtable("Data.xlsx",'Sheet',1);
app.UITable.Data = app.data;
app.UITable.ColumnName=app.data.Properties.VariableNames;
app.UITable.ColumnEditable = true;
The Data consists of 6 columns, I want to add drop-down menu to column 4, then a correspond value appears in column 5 based on the selection in column 4 and use the value in column 5 and multiple it with the value in column 3 and the asnwer appears in column 6

Accepted Answer

Adam Danz
Adam Danz on 5 Oct 2020
Edited: Adam Danz on 6 Oct 2020
Refer to Matlabs documentation on the uitable's ColumnFormat property which demonstrates how to set up pop-up menus within a column of a uitable by setting that columns' format as a cell array of options.
The ColumnEditable property of column 5 & 6 should be set to false since you plan to programmatically set those values.
The rest can be achieved by table indexing and whatever math you apply.

More Answers (0)

Categories

Find more on Environment and Settings 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!