drop-down menu in uitable
18 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Voss
2023 年 12 月 13 日
編集済み: Voss
2023 年 12 月 13 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Industrial Statistics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!