How to add (combine) together two structures with the same fields?
Afficher commentaires plus anciens
Dear All,
I have two structures A and B with the same fields. How can I combine them together to form a new structure?
For example, A = struct('field1', array1, 'field2', array2); B = struct('field1', array3, 'field2', array4). A and B have the same fields 'field1' and 'field2'. I want to combine A and B together to obtain structure C = struct('field1', [array1; array3], 'field2', [array2; array4]). array1 and array3 have the same number of columns, and array2 and array4 have the same number of columns.
Thanks.
Benson
2 commentaires
Geoff Hayes
le 11 Juin 2021
Benson - what should the new structure look like? If A and B have the same fields, then does that mean that the combined A and B have array fields? Please illustrate with a small example.
Benson Gou
le 11 Juin 2021
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Audio and Video Data dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!