Is there a variant of Matlab structs that does not enforce the order of the fields? <p>I want to add data to an array of structs without the fields of the added structs necessarily having the same <em>order</em> as the fields of the original structs. For example:</p> <pre><code>% Works fine: students.name = 'John'; students.age = 28; student2.name = 'Steve'; student2.age = 23; students(2) = student2; % Error if the order of the fields of student2 is reversed students.name = 'John'; students.age = 28; student2.age = 23; student2.name = 'Steve'; students(2) = student2; % Error: Dissimilar structs </code></pre> <p>Is there a variant of struct I can add data to without having to keep the same order of fields?</p> <p>EDIT: One workaround would be to always use matlabs "orderfields", which orders fields alphabetically. That is, the above erroneous example would become:</p> <pre><code>% Order fields alphabetically students.name = 'John'; students.age = 28; student2.age = 23; student2.name = 'Steve'; students = orderfields(students); student2 = orderfields(student2); students(2) = student2; % Works </code></pre> <p>I am not sure whether this is the most natural solution.</p>