table2struct

table2struct(t) converts table t into a struct.

Examples

>> Name = {'John';'Marc';'Sam';'Toni'}
Grades = {'B';'A';'B';'F'}
DOB = {'02-Jun-2012';'12-Feb-2012';'04-Oct-2011';'29-Aug-2012'}
T = table(Name,Grades,DOB,'VariableNames',{'First_Name' 'Grade' 'Date_birth'})#

 First_Name Grade   Date_birth 
       John     B  02-Jun-2012 
       Marc     A  12-Feb-2012 
        Sam     B  04-Oct-2011 
       Toni     F  29-Aug-2012 

>> s = table2struct(T)#

 First_Name: [4x1 string array]
 Grade: [4x1 string array]
 Date_birth: [4x1 string array]

>> s.Date_birth#

02-Jun-2012
12-Feb-2012
04-Oct-2011
29-Aug-2012

See also

table | struct