Creating a Basic UI Table
We can create a UI table by passing a prepared data to a uitable component.
Example 1:
Matlab
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, 'Data' ,tab); |
In this example, we create a uifigure component which is the only way of converting a table to a uitable in MATLAB R2018a onwards, the same is explained in detail in the following section. Then, we create a table with three variables. After that, the uitable function is called with the uif uifigure component and tab as the ‘Data’ component.
Output:
This is an example of a simple uitable. We shall use this same table in the following sections to understand the properties of UI tables.
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.