table2array

Creates an array from the table t.

Syntax

table2array(t)

Inputs

t
Type: table

Outputs

R
Resulting matrix.

Example

Simple table2array example:
Lake = [6,10,13,18,20];
Area = [31700, 22300, 23000, 9910, 7340];
Volume = [2900, 1180, 850, 116, 393];
t = table(Lake, Area, Volume)
R = table2array(t)
R = [Matrix] 5 x 3
 6  31700  2900
10  22300  1180
13  23000   850
18   9910   116
20   7340   393
convert specific variables of table to array
Lake = {'Superior','Michigan','Huron','Erie','Ontario'};
Area = [31700, 22300, 23000, 9910, 7340];
Volume = [2900, 1180, 850, 116, 393];
t = table(Lake, Area, Volume)
R = table2array(t(:,[2,3]))
R = [Matrix] 5 x 2
31700  2900
22300  1180
23000   850
 9910   116
 7340   393

Comments

table2array only supports tables with 1. non numeric data in all columns. 2. must have same sizes in all columns.