problem to change color after dropdown menu
1 次查看(过去 30 天)
显示 更早的评论
hi, i use dropdown menu in app designer to change value in table .
C is matrix with rows and columns to be highlighted in yellow
but the previous colors remain
function DateSearchDropDown_5Clicked(app, event)
item = event.InteractionInformation.Item;
if ~isempty(item)
[app.UITable_CorrelationTab.Data,c]=Table_Correlazione_Struct(app.Eq,app.Preset,app.DateSearchDropDown_5.Value);
s = uistyle('BackgroundColor','yellow');
addStyle(app.UITable_CorrelationTab,s,'cell',c);
end
end
I think you have to restore the original colors and then color the new matrix
How can do it?
0 个评论
采纳的回答
Voss
2023-8-5
编辑:Voss
2023-8-5
If that's the only uistyle you use on the table, then calling removeStyle to remove all uistyles before adding the new one should work:
function DateSearchDropDown_5Clicked(app, event)
removeStyle(app.UITable_CorrelationTab);
item = event.InteractionInformation.Item;
if ~isempty(item)
[app.UITable_CorrelationTab.Data,c]=Table_Correlazione_Struct(app.Eq,app.Preset,app.DateSearchDropDown_5.Value);
s = uistyle('BackgroundColor','yellow');
addStyle(app.UITable_CorrelationTab,s,'cell',c);
end
end
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!