MATLAB: How to concatenate or merge two structures

concatenatejoin;MATLABmergestructures

I would like to merge two structures into a new structure containing all the fields of the two original structures. How can I do this in MATLAB?

Best Answer

There is no direct ability in MATLAB that can be used to concatenate structures.
The attached file mergeStructs.m shows a number of methods that can be used to merge structures in MATLAB.
There are also online submissions on the MATLAB Central User Community that you can use. One such submission is :
Note that MathWorks does not guarantee or warrant the use or content of these submissions. Any questions, issues, or complaints should be directed to the contributing author.