dynamic variable error 'Argument to dynamic structure reference must evaluate to a valid field name'
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I get this error message appearing from the line indicated. Can anyone suggest why this might be happening? Thanks!
i=xD20V10sweep3rd.(2); i=i(1920);
v=xD20V10sweep3rd.(1); v=v(1920);
c7d_20V=i/v;
i=xD20V10sweep3rd.(2); i=i(1894);
v=xD20V10sweep3rd.(1); v=v(1894);
c7d_10V=i/v;
i=xD20V5sweep3rd.(2); i=i(1881); <----------------------------------error source
v=xD20V5sweep3rd.(1); v=v(1881);
c7d_5V=i/v;
i=xD20V10sweep3rd.(2); i=i(1881);
v=xD20V10sweep3rd.(1); v=v(1881);
c7d_5V=i/v;
c7d=(c7d_20V/c7d_5V)-1
I find this error message really strange because the previous identical code is not causing any error messages and I ran a almost identical code (different mathematical operator) and no error message resulted!
EDIT:
I solved this by just using table2array and dealing with an array instead.
1 个评论
Mohith Kulkarni
2020-11-25
Could you provide a detailed explanation along with the code you have tried so that we can replicate the issue. what does the "xD20V5sweep3rd" variable contain. The error usually happens when indexing into a structure with an invalid field name.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Debugging and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!