Fonts in UI tables
There are various options available for changing the font appearance in a UI table. Discussing them all is not feasible here; therefore, we shall explain the more important ones such as font weight and font angle.
Font weight
Font weight has 2 values, ‘normal’ and ‘bold’. Both have the same meaning as used in ordinary typing. The default option is ‘normal’; to change the weight to ‘bold’ one needs to use the ‘FontWeight’ option and give its value as ‘bold’.
Example 5:
Matlab
% Code uif = uifigure; age = [32 ;23; 15; 17; 19]; names = { 'Howard' ; 'Harry' ; 'Mark' ; 'Nik' ; 'Mike' }; gen = { 'M' ; 'M' ; 'M' ; 'F' ; 'M' }; tab = table(age,names,gen); tab = uitable(uif, 'FontWeight' , 'bold' , 'Data' ,tab); |
Output:
As it can be seen, all the fonts are bold now.
Font Angle
This option is generally used to turn the ‘italic’ font mode on or off. One simply has to use the FontAngle option and pass the argument as ‘italic’. This changes all the font to italic.
Example 7:
Matlab
% Code uif = uifigure; age = [32 ;23; 15; 17; 19]; names = { 'Howard' ; 'Harry' ; 'Mark' ; 'Nik' ; 'Mike' }; gen = { 'M' ; 'M' ; 'M' ; 'F' ; 'M' }; tab = table(age,names,gen); tab = uitable(uif, 'FontAngle' , 'italic' , 'Data' ,tab); |
Output:
Control Table UI Component Appearance and Behavior in MATLAB
In this article, we shall discuss how to create UI tables in MATLAB and control their behaviors and appearance by manipulating some basic properties and visuals. UI tables in MATLAB are the graphical form of tabular data. The UI tables can be created using the uitable function.
Syntax
tab = uitable(…parameters…)
The uitable without any parameters generates an empty table. Different parameters could be passed to the same for data modification. We shall not discuss creating UI tables in depth as it is not in this article’s scope.