Table customization in figures
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Abhishek Chakram
le 9 Oct 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 commentaire
daremo
le 22 Mar 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:
Voir également
Catégories
En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!