problem to change color after dropdown menu

1 view (last 30 days)
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?

Accepted Answer

Voss
Voss on 5 Aug 2023
Edited: Voss on 5 Aug 2023
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

More Answers (0)

Categories

Find more on Data Exploration 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!