table2struct

Creates a struct from the table t.

Syntax

table2struct(t)

Inputs

t
Type: table

Outputs

R
Resulting Struct.

Example

Simple table2struct example:
Lake = {'Superior','Michigan','Huron','Erie','Ontario'};
Area = [31700, 22300, 23000, 9910, 7340];
Volume = [2900, 1180, 850, 116, 393];
t = table(Lake, Area, Volume);
R = table2struct(t)
R =
struct [
  Area: [Matrix] 1 x 5
  31700  22300  23000  9910  7340
  Lake: 
  {
	[1,1] Superior
	[1,2] Michigan
	[1,3] Huron
	[1,4] Erie
	[1,5] Ontario
  }
  Volume: [Matrix] 1 x 5
  2900  1180  850  116  393
]