when i run this script i get an error 'Field assignment to a non-structure array object.' in line 10
조회 수: 4 (최근 30일)
이전 댓글 표시
clear
clc
k=4;
l = "tile%d";
str = sprintf(l,k);
str.value={};
str.bonus={};
str.value=4
str.bonus='dots'
댓글 수: 0
답변 (1개)
Star Strider
2017년 9월 17일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!