Merge Structures

Recursively merges fields and subfiels of two structures.
494 Downloads
Updated 2 Dec 2011

View License

% Simple recursive algorithm merges fields and subfields of two structures
% Example:
% A.field1=1;
% A.field2.subfield1=1;
% A.field2.subfield2=2;
%
% B.field1=1;
% B.field2.subfield1=10;
% B.field2.subfield3=30;
% B.field3.subfield1=1;
%
% C=mergestruct(A,B);
%

Cite As

Igor Kaufman (2024). Merge Structures (https://www.mathworks.com/matlabcentral/fileexchange/34054-merge-structures), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Structures in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0