Why do I get the error "Subscripted assignment dimension mismatch" when using a cell array in a structure field?
Show older comments
I have the following lines of code which work:
layers(1)=struct('test', 'ABC', 'value', 0.50);
layers(2)=struct('test', 'DEF', 'value', []);
I would like to combine the "test" and "value" fields into a single field like this:
layers(1)=struct('test', {'ABC', 0.50});
layers(2)=struct('test', {'DEF'});
This gives the error message "Subscripted assignment dimension mismatch."
Is there a way to put a 1x2 cell into a single field in the structure?
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!