when i run this script i get an error 'Field assignment to a non-structure array object.' in line 10
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
clear
clc
k=4;
l = "tile%d";
str = sprintf(l,k);
str.value={};
str.bonus={};
str.value=4
str.bonus='dots'
0 commentaires
Réponses (1)
Star Strider
le 17 Sep 2017
Your ‘str’ variable is a character array or a (1x1) string object, not a structure. You cannot address it as a structure.
If you want to create a structure, see the documentation on struct (link) and related documentation for details.
0 commentaires
Voir également
Catégories
En savoir plus sur Structures dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!