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
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 CenterFile Exchange 中查找有关 Debugging and Analysis 的更多信息

产品


版本

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by