Code covered by the BSD License  

Highlights from
CatStruct2

5.0

5.0 | 1 rating Rate this file 2 Downloads (last 30 days) File Size: 2.47 KB File ID: #34401

CatStruct2

by Hassan

 

31 Dec 2011

Concatenates Structures (fields each depth are merged)

| Watch this File

File Information
Description

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
http://www.mathworks.com/matlabcentral/fileexchange/7842-catstruct/content/catstruct.m

Required Products MATLAB
MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
concatenate, construct(2), deepcopy, deepmerge, merge, merging, struct, structs, structure(2), structures
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
20 Mar 2012 Andrey

Excellent submission. I can hardly understand why the original catstruct didn't have this functionality.

Contact us