Why do I get the error "Subscripted assignment dimension mismatch" when using a cell array in a structure field?
Afficher commentaires plus anciens
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?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Structures dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!