table2cell

Converts a table to a cell array.

Category: Language Fundamentals > Data Types

Syntax

C = table2cell(T)

Returns a cell array with one cell per table element.

Description

Unlike table2array, it works with mixed content: numbers stay numbers and text stays text, each in its own cell. The variable names and row names are dropped, so keep T.Properties.VariableNames if you need them later.

cell2table performs the reverse conversion.

Input arguments

T
Table of any variable types.

Output arguments

C
Cell array with as many rows as T and one column per variable column; names are not included.

Example

Mixed content

T = table([1;2], {'a';'b'});
C = table2cell(T)
Output
C = 2×2 cell

    {[1]}    {'a'}
    {[2]}    {'b'}

See also

cell2table table2array table2struct table