Why does field order matter when defining structures?
Show older comments
Two structures with the same field names in a different order can not be set to equal each other, even though they are nearly identical.
This example shows the problem:
a(1).begin = 1;
a(1).end = 2;
b.end = 3;
b.begin = 4;
a(2) = b;
% Error :
??? Subscripted assignment between dissimilar structures.
Accepted Answer
More Answers (0)
Categories
Find more on Structures in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!