MATLAB Function Reference | ![]() ![]() |
Convert cell array to structure array
Syntax
s = cell2struct(c,fields,dim)
Description
s = cell2struct(c,fields,dim)
converts the cell array c
into the structure s
by folding the dimension dim
of c
into fields of s
. The length of c
along the specified dimension (size(c,dim)
) must match the number of fields names in fields
. Argument fields
can be a character array or a cell array of strings.
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 | ![]() |