problem to change color after dropdown menu

1 visualización (últimos 30 días)
pipin
pipin el 5 de Ag. de 2023
Editada: Voss el 5 de Ag. de 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?

Respuesta aceptada

Voss
Voss el 5 de Ag. de 2023
Editada: Voss el 5 de Ag. de 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

Más respuestas (0)

Categorías

Más información sobre Data Exploration en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by