MATLAB: Is it possible to concatenate structures with the same fields in to one super structure

concatenate structures

I have structures c and c1, each contain 55 fields with the same names.
The field dimensions differ slightly in the x domain (ie):
c.E: [68×120 single]
c.N_z_cross: [68×120 single]
c.N_z_long: [68×120 single]
and
c1.E: [84×120 single]
c1.N_z_cross: [84×120 single]
c1.N_z_long: [84×120 single]
ideally I would like to create a structure that contains both continually (ie)
full_data.E: [152×120 single]
full_data.N_z_cross: [152×120 single]
full_data.N_z_long: [152×120 single]
Is there anyway to do this without manually concatenating each variable?
Thanks in advance.

Best Answer

>> S.data = 1;
>> S.year = 2017;
>> T.data = 2;
>> T.year = 1988;
>> Z = cell2struct(cellfun(@vertcat,struct2cell(S),struct2cell(T),'uni',0),fieldnames(S),1);
>> Z.data
ans =
1
2
>> Z.year
ans =
2017
1988
It would be perfect if structfun accepted multiple input structures, but sadly it only works on one input struct :(