cell2struct
Convert a cell array to structure array with specified keys.
y=cell2struct(c,fieldnames,fielddim)
Inputs
c a cell array.
fieldnames an array of strings
fielddim Dimension of c that should folded into the fieldnames.
Outputs
y A structure array.


Description
If n is the dimension of c , cell2struct returns a structure array of dimension n-1 without the dimension fielddim . The fields of the structure array are the fieldnames , and the size of this array should be the same as size(c,fielddim) . If for example, fielddim is 4 , and fieldnames{M} is "fieldm" , the resulting structure array is such that y.fieldm is c{:,:,:,M,:,:,:} .
Example
>>c={'a',5,'b'};
>>f={'x','y','z'};
>>cell2struct(c,f,2)
    x:   a
    y:   b
    z:   5