I've found a workaround for this problem. Instead of changing the foreground, I'm changing the background. The background color of each row is saved in a matrix containing the RGB values of each row of the table. This matrix is passed as a 'BackgroundColor' argument while displaying the uitable.
How to change the color of uitable 'row-wise'?
27 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Himanshu Verma
el 15 de Mayo de 2020
Respondida: Himanshu Verma
el 26 de Ag. de 2020
I have a tool which plots data based on the user selection. The tool plots the line on 3 graphs and I've created uitable which displays the properties of the plotted line. I want to update the color of the text of the row according to the color of the line plotted. The table should get updated whenever a new line is plotted as well as the color of that one row only should change. How can I do that?
function tab_input(ui_table,cell_1a,cell_1b,cell_2,cell_3)
cell_1 = strcat(cell_1a,cell_1b,cell_1a);
existingData = get(ui_table,'Data');
tempData = {cell_1,cell_2,cell_3};
newData = [existingData;tempData];
set(ui_table,'Data',newData,'ForegroundColor',ci_color(cell_2));
end
In the above code, I want to append the table as well as, I want to change the textcolor of the current row only, whereas the color or the previous row (if any) should remain unaltered. Please suggest a workaround.
0 comentarios
Respuesta aceptada
Más respuestas (1)
Jyotsna Talluri
el 18 de Mayo de 2020
Editada: Jyotsna Talluri
el 18 de Mayo de 2020
You can make use of uistyle and addstyle functions
Refer to the documnetation link below
4 comentarios
Ver también
Categorías
Más información sobre Migrate GUIDE Apps 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!