What does the "Reference to non-existent field" error message mean?
42 次查看(过去 30 天)
显示 更早的评论
I am investigating why China has inflation, and we Indian students are trying to understand it. The China data we got, and inflation perform in China. So we can take precaution for our county in India too.
I am getting this error and I am not aware that why I am getting such an error. Can anyone guide me please ?![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/329957/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/329957/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/330005/image.jpeg)
采纳的回答
Image Analyst
2020-7-10
Input.T_11 is defined in Main.m. Main.m calls Func_Task_11.m but does not pass Input to Func_Task_11() so when you get inside Func_Task_11, the Input variable is not in scope. Remember each function has it's own workspace separate from the others. If you want input in Func_Task_11(), you need to pass it in
In Main.m:
Func_Task_11(Input);
In Func_Task_11.m
function Func_Task_11(Input)
as the first line.
Also, do not use eps as a variable name - it's a built-in function.
更多回答(1 个)
Robert
2020-7-10
编辑:Robert
2020-7-10
The error message says that there is no field "T11" in (struct-) variable "Input". Set a breakpoint on the respective line and check.
It looks like you edited the script "Func_Task_11" after the error message was thrown, as line 29 in your screenshot is empty. If you didn't edit inbetween, "Func_Task_11.m" might be shadowed by another script of the same name on the matlab-path.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Manual Performance Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!