I have:
A =
a: 1
b: 2
c: 3
d: 4
B =
e: 10
d: 10
b: 10
a: 10
I want to concatenate those two as the following.
new_struct =
a: 11
b: 12
c: 3
d: 14
e: 10
The order of fields in ‘new’ does not matter.
I’ve been trying to learn efficient matlab programming. How would I do this without using for loops and if statements?
I would suggest CATSTRUCT and have a look at what Loren’s got here. I think you were hoping for a more elegant solution, but I think these techniques are what the community has settled.