Skip to content

struct2table

Convert a struct array to a table.

T = struct2table(s)
T = struct2table(s, 'VariableNames', {'name1', ...})

Each field of s becomes a column variable in the resulting table. For struct arrays, each element becomes one row.

s(1).id = 1; s(1).val = 3.5;
s(2).id = 2; s(2).val = 4.7;
struct2table(s)
  • table — Create a table — a heterogeneous tabular data container.
  • struct — Create a structure with named fields.