Why Struct contents reference from a non-struct array object occurs?
Show older comments
Hi, When I'm executing the code, I always face the problem 'Struct contents reference from a non-struct array object. In my program every time it is showing this error in such cases
'varnames = old.allVarNames'
Can anyone please tell me why it occurs and what should be the solution in above case?
3 Comments
madhan ravi
on 1 Nov 2018
You still didn’t provide enough information needed
Walter Roberson
on 1 Nov 2018
Is old created by using load() or importdata()?
Answers (3)
Stephan
on 1 Nov 2018
0 votes
Hi,
since you give very little information use:
to find a solution. Otherwise tell us a little bit more. See:
Best regards
Stephan
Image Analyst
on 1 Nov 2018
Set a breakfront there and then double click old in the workspace to bring it up in the variables window. Or type old on the command line. You will see its values, and that it is not a structure, but some other type of variable:
>> whos old
>> old
Ouafae errachedy
on 21 Apr 2022
0 votes
I always face the problem 'Struct contents reference from a non-struct array object. In my program every time it is showing this error.
Struct contents reference from a non-struct array object.
Error in updateApp (line 6)
str1 = num2str(rto1.InputPort(1).Data);
Can anyone please tell me why it occurs and what should be the solution
1 Comment
Image Analyst
on 21 Apr 2022
The reason is that your rto1 variable is not a structure or static class so you can do "dot anything". Or if rto1 is a structure, then rto1.InputPort(1) is not a structure with a field called "Data".
The answer is the same as for the original poster.
Set a break point there and look in the workspace at the variable to see what it actually is. Or when stopped there, put this in the command window
>> whos rto1
>> rto1
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!