T = cell2table(C)
T = cell2table(C, Name, Value)
| Parameter | Description |
|---|---|
| C | 2-D cell array. |
| Name, Value | Name-value arguments, in any order: 'VariableNames' (string array or cell array of character vectors, one name per column of C), 'RowNames' (string array or cell array of nonempty names, one name per row of C), 'DimensionNames' (two names). Names are case-insensitive. |
| Parameter | Description |
|---|---|
| T | Table object. |
T = cell2table(C) converts the contents of an m-by-n cell arrayC into an m-by-n table.
Each column of the input cell array becomes the data for a corresponding variable in the output table.
To generate variable names in the output table,cell2table appends the column numbers to the name of the input array.
If the input array does not have a name,cell2table assigns default variable names in the format "Var1", "Var2", ... , "VarN" , where N is the number of columns in the cell array.
T = cell2table(C, Name, Value) creates the table with the name-value arguments VariableNames, RowNames and DimensionNames. These values are validated like the ones given to table; any other name raises an error.
C = {'John', 28, true; 'Alice', 35, false; 'Bob', 42, true};
% Convert the cell array to a table
T = cell2table(C)
C = {'John', 28; 'Alice', 35};
T = cell2table(C, 'VariableNames', {'Name', 'Age'}, 'RowNames', {'r1', 'r2'})
| Version | Description |
|---|---|
| 1.8.0 | initial version |