drop-down menu in uitable
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Voss
le 13 Déc 2023
Modifié(e) : Voss
le 13 Déc 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!