필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Attempt to refrence field of non structured array

조회 수: 1 (최근 30일)
Sudarshan
Sudarshan 2012년 11월 12일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello,
I am new to MATLAB and I am trying to use the MOGA tool for optimization. When I run the optimization I get the following error
??? Attempt to reference field of non-structure array.
Error in ==> gamultiobjsolve at 28
state.Generation = state.Generation + 1;
Error in ==> gamultiobj at 240
[x,fval,exitFlag,output,population,scores] = gamultiobjsolve(FitnessFcn,nvars, ...
It would be great if you could help me out.

답변 (1개)

Jan
Jan 2012년 11월 12일
Please post how you call the function. It seems like the varaible "state" should be a struct, but it has another type.
A general method to identify such problems is using the debugger:
dbstop if error
Then start the program again and Matlab stops, when the error occurres. Now you can inspect the calling tree and the values of the locally used variables.
  댓글 수: 3
Jan
Jan 2012년 11월 12일
I do neither know the MOGA tool, nor can I guess what "use for" means in this case. Did you try to debug your code already? You know, debugging is a very important tool for creating programs and it has much more power than a forum.
Sudarshan
Sudarshan 2012년 11월 12일
Thanks for ur help... I will try to do tat...

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by