Table customization in figures
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello, I want to cutomize a table that i draw in a figure. I can change the font of the values, but not the font size of the column and row title. Also setting the column width as auto, doesnt fit when font size of the data is increased. i need to do this manually.
my code:
pos = get(tbl, 'Position');
un = get(tbl, 'Units');
uitable(h2, 'Data', T_tx1{:,:},...
'FontSize', 13,...
'ColumnWidth', {100,100,100},...
'ColumnName', T_tx1.Properties.VariableNames,...
'RowName', T_tx1.Properties.RowNames,...
'Units', un, 'Position', [pos(1) 2/3 (1-pos(1)) (1-2/3)]);
uitable(h2, 'Data', T_tx2{:,:},...
'FontSize', 13,...
'ColumnWidth', {100,100,100},...
'ColumnName', T_tx2.Properties.VariableNames,...
'RowName', T_tx2.Properties.RowNames,...
'Units', un, 'Position', [pos(1) 1/3 (1-pos(1)) (1-2/3)]);
Also is there any way to highlight the cells based on some criteria? like yellow, green or red? And control the decomal points of the values?
0 comentarios
Respuestas (1)
Abhishek Chakram
el 9 de Oct. de 2023
Hi Md Arif Ahmed Roni.
It is my understanding that you want to change the font size of the column and row titles and highlight a row based on some criteria. The ability to control the font size of “uitable” column and row title in MALTAB is not supported currently. However, you can highlight a row using “uistyle” and “addStyle” functions. Here is a sample code for the same:
s = uistyle("BackgroundColor","yellow");
for i=1:row % no. of rows
if i==2
addStyle(uit,s,"row",i);
end
end
You can refer to the following documentation to know more about the functions used:
Best Regards,
Abhishek Chakram
1 comentario
daremo
el 22 de Mzo. de 2024
Hi,
I think you can control the header of columns and rows by html code, have a look into the details with below link:
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!