??? Subscripted assignment between dissimilar structures.

I am using a structure in my script m-file. Everytime I run my code, I get the following error:
??? Subscripted assignment between dissimilar structures.
To run the code, I clear all the variables and then re-run the code. This way I don't get the error. Is there something that I am missing?
Thanks.

 採用された回答

Jan
Jan 2011 年 6 月 12 日

2 投票

The error message contains the line number also. Inspect this line to find out, why the structs are different.
Another method for debugging is using the debugger (sic!):
dbstop if error

1 件のコメント

AP
AP 2011 年 6 月 12 日
Thank you Jan. This is a really cool.

サインインしてコメントする。

その他の回答 (2 件)

Matt Fig
Matt Fig 2011 年 6 月 12 日

0 投票

It sounds like you are running a script instead of a function? If so, my guess is that with a clear workspace your code creates some variables, but these creation assignments don't work right when the variables are built up by the code if run again without a clear workspace. This is the best I can do without seeing the code...

1 件のコメント

AP
AP 2011 年 6 月 12 日
Thank you. The error was because of the following:
in the definition of the structure I had defined MaterialSize whereas in my code I had used Materialsize where the letter 's' is not capitalized as in the definition.

サインインしてコメントする。

Marine
Marine 2014 年 11 月 24 日

0 投票

I have actually the same mistake as AP, but the point is that when I test me structures, they are supposed to be the same in the program, and I really don't know why I got this message. One of my structure comes from a .mat-file, and the other is describe in my script... Can anybody help me please ?

1 件のコメント

Matt J
Matt J 2014 年 11 月 24 日
What about Jan's answer, recommending dbstop? What does that reveal?

サインインしてコメントする。

質問済み:

AP
2011 年 6 月 11 日

コメント済み:

2014 年 11 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by