T=5×3 table
Gender Age BloodPressure
______ ___ _____________
Smith M 38 124 93
Johnson M 43 109 77
Williams F 38 125 83
Jones F 40 117 75
Brown F 49 122 80
将 T 转换为标量结构体。
S = table2struct(T,'ToScalar',true)
S = struct with fields:
Gender: [5x1 categorical]
Age: [5x1 double]
BloodPressure: [5x2 double]
为表中的行名称添加字段。
S.RowNames = T.Properties.RowNames
S = struct with fields:
Gender: [5x1 categorical]
Age: [5x1 double]
BloodPressure: [5x2 double]
RowNames: {5x1 cell}
如果 S 为非标量结构体,请使用 [S.RowNames] = T.Properties.RowNames{:} 包含行名称来自表中的字段。
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.