| MATLAB Function Reference | ![]() |
表示
s = cell2struct(c,fields,dim)
詳細
s = cell2struct(c,fields,dim) は、cの次元 dim を s のフィールドに割り当てることにより、セル配列c を構造体 s に変換します。指定した次元でのc の長さ (size(c,dim)) は、fields内のフィールド名の数と一致しなければなりません。引数fields は、文字列配列または文字列のセル配列でも構いません。
例題
c = {'tree',37.4,'birch'};
f = {'category','height','name'};
s = cell2struct(c,f,2)
s =
category: 'tree'
height: 37.4000
name: 'birch'
参考
| cell | celldisp | ![]() |