drop-down menu in uitable
19 views (last 30 days)
Show older comments
pl=struct2table(app.Preset);
app.Preset_UITable.Data=pl;
app.Preset_UITable.ColumnName = pl.Properties.VariableNames;
RankMode=Function_Categorical_Struct("RankingMode");
cat = categories(RankMode);
colu={'char' {cat{:}} };
app.Preset_UITable.ColumnFormat=colu;
i receive this error:
Warning: 'ColumnFormat' value has no effect when 'Data' value is a table array.
%{
RankMode =
6×1 categorical array
Descending Net Profit
Ascending Net Profit
Descending historical MaxDD
Ascending historical MaxDD
Descending NetProfit/MaxDD ratio
Ascending NetProfit/MaxDD ratio
%}
How do I open the menu with the menu below by pressing the button ?
0 Comments
Accepted Answer
Voss
on 13 Dec 2023
Edited: Voss
on 13 Dec 2023
As the warning suggests, if you want to use ColumnFormat your Data can't be a table. Try using a cell array for Data, as in:
pl = struct2table(app.Preset);
app.Preset_UITable.Data = table2cell(pl);
Then you can set ColumnFormat to include a cell array of chars representing the items in a drop-down menu.
I'm not sure how many columns your table has (the screenshot shows 4, but the ColumnFormat/colu you define has 2) nor which column is intended to contain the drop-down menus. Make sure ColumnEditable is set to true on the drop-down column. You should avoid naming a variable cat, since that's the name of a built-in function.
app.Preset_UITable.ColumnName = pl.Properties.VariableNames;
RankMode = Function_Categorical_Struct("RankingMode");
cats = categories(RankMode);
% 4 columns, 3rd is drop-downs; adjust as needed:
colu = [{'char'} {'char'} {cats.'} {'char'}];
app.Preset_UITable.ColumnFormat = colu;
0 Comments
More Answers (0)
See Also
Categories
Find more on Industrial Statistics 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!