table2array — Convert table variables into a homogeneous array when possible.
table2array(T) horizontally concatenates compatible table variables into one homogeneous array. Table row names, timetable row times, and other table properties are not included.
Syntax
A = table2array(T)Inputs
T- Type
Any- Required
- Yes
- Description
- Input table or timetable.
Returns
B- Type
Any- Description
- Converted output value.
Errors
RunMat:table:InvalidArgument- When
- Arguments or table metadata are invalid.
- Message
table: invalid argument
RunMat:table:InvalidIndex- When
- Table indexing is invalid.
- Message
table: invalid index
RunMat:table:InvalidVariable- When
- A table variable name or value is invalid.
- Message
table: invalid variable
Behavior
Same-class integer variables concatenate without conversion, preserving exact signedness, width, and values above flintmax.
Compatible mixed numeric variables use the table-concatenation dominant class and its assignment conversion rules. A native single variable makes an otherwise floating result single.
If all variables are cell arrays, the result is a cell array equivalent to table2cell(T). Broader heterogeneous concatenation remains limited by the currently implemented table indexing surface.
Execution and placement
The table container is host-side. Nested resident variables are not gathered solely by this conversion; unsupported heterogeneous combinations can remain cell-valued with resident elements.
Host-side conversion is a fusion boundary.
Examples
Converting Numeric Variables To A Matrix
A = table2array(array2table([1 3; 2 4]))Preserving Wide Integer Values
T = table(uint64([0x0020000000000001u64;0x0020000000000003u64])); A = table2array(T)Using table2array with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how table2array changes the result.
Run a small table2array example, explain the result, then change one input and compare the output.
Related Table functions
Table
array2table · array2timetable · categorical · cell2table · dictionary · groupsummary · head · iscategorical · isordinal · istable · istimetable · ordinal · pivot · rowfilter · struct2table · table · table2cell · table2struct · table2timetable · timerange · timetable · timetable2table · uitable · vartype
Indexing
dictionary.subsasgn · dictionary.subsref · table.subsasgn · table.subsref
Source you can read
Every RunMat function's source is public. Read exactly how table2array is executed, line by line, in Rust.
- View the source for table2array in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.