problem to change color after dropdown menu

1 Ansicht (letzte 30 Tage)
pipin
pipin am 5 Aug. 2023
Bearbeitet: Voss am 5 Aug. 2023
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?

Akzeptierte Antwort

Voss
Voss am 5 Aug. 2023
Bearbeitet: Voss am 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

Weitere Antworten (0)

Kategorien

Mehr zu Data Exploration finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by