Merge Structures

Recursively merges fields and subfiels of two structures.

You are now following this Submission

% 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 (2026). Merge Structures (https://www.mathworks.com/matlabcentral/fileexchange/34054-merge-structures), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0.0