| MATLAB Function Reference | ![]() |
轉換陣列格(cell array)為結構陣列(structure array)
Syntax
s = cell2struct(c,fields,dim)
Description
s = cell2struct(c,fields,dim)
疊合 c 的維度 dim 與 s 的欄位 fields,將陣列格 c 轉換為結構 s。疊合的 c 維度長度 (size(c,dim)) 必須與 s 的欄位數 fields 相同。參數 fields 可以是字元陣列或是字串陣列格。
Examples
c = {'tree',37.4,'birch'};
f = {'category','height','name'};
s = cell2struct(c,f,2)
s =
category: 'tree'
height: 37.4000
name: 'birch'
See Also
| cell | celldisp | ![]() |