MATLAB: Structures and cells – how to modify and save

struct cell

Hello,
I have a simple question regarding the transform between struct and cell..
A
ans =
1x1158 struct array with fields:
type
latency
urevent
B = struct2cell(A);
B is now <3x1x1158 cell>
How do I know transform B back into struct?
I tried this:
fields={'type','latency','urevent'};
D=cell2struct(C,fields,1158);
??? Error using ==> cell2struct
Number of field names must match number of fields in new structure.
Help!

Best Answer

D=cell2struct(C,fields,1);