Code covered by the BSD License
31 Dec 2011
Concatenates Structures (fields each depth are merged)
Watch this File
FinalStruct = CatStruct2(S1,S2) concatenates the structures S1 and S2 into one structure FinalStruct.
The fieldnames at each depth will be compared. In case the field name is found in both structures, the second occurence will overwrite the value of the first.
CatStruct2(S1,S2,'sorted') will sort the fieldnames alphabetically after merging the two structures.
Thanks to Jos van der Geest for providing the source code of CATSTRUCT on
Exactly what I was looking for after first trying out Jos' submission. Unfortunately StrCmpFN on line 116 is undefined resulting in an error.
Excellent submission. I can hardly understand why the original catstruct didn't have this functionality.