I am trying to merge two structs with identical fields. I tried several ways, such as this and this. But it either turns out sideways or doesn't work at all.
My two (simplified) structs are
a(1).name = 'x';
a(1).data = 1;
a(2).name = 'y';
a(2).data = 2;
and
b(1).name = 'x';
b(1).data = 3;
b(2).name = 'y';
b(2).data = 4;
The desired output is identical to what this would produce:
c(1).name = 'x';
c(1).data = 1;
c(2).name = 'y';
c(2).data = 2;
c(3).name = 'x';
c(3).data = 3;
c(4).name = 'y';
c(4).data = 4;
What is an easy way to do this? In my real struct, there are more than two fields with over a thousand values.