Why do I get the error: "Attempt to reference field of non-structure array"?
Show older comments
I refer to a function using a dataset transferred from stata, and I get the following message:
"Attempt to reference field of non-structure array.
Error in livsindkomst (line 26)
data(find(st_dataset.udd~=uddtype),:)=[];
end"
st_dataset is the data transferred from stata, but it seems like there is a problem refering to this data. Specifically, my aim is to check whether the variable udd equals the variable uddtype, and delete it if it does not. I define the variable uddtype in my programme.
2 Comments
Adam
on 20 Jul 2016
Use the debugger, put a breakpoint on that line and see if st_dataset is actually a struct. It seems either it is something else or it is empty, if that is possible from the data transfer, which is technically a double.
Jacob Victor Hansen
on 20 Jul 2016
Accepted Answer
More Answers (1)
You must verify that st_dataset really is a variable of the type that you intend it to be. MATLAB is complaining that it is not a variable that accepts dot-indexing syntax like st_dataset.udd. Maybe it is just a scalar number, for example.
Categories
Find more on Programming 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!