dynamic variable error 'Argument to dynamic structure reference must evaluate to a valid field name'

2 Ansichten (letzte 30 Tage)
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 Kommentar
Mohith Kulkarni
Mohith Kulkarni am 25 Nov. 2020
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Structures finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by