struct contents reference from a non-struct array object [Help Please]
显示 更早的评论
Hi everybody ,
Please i have an error occur in this statement the error is [struct contents reference from a non-struct array object] :
if(EndC)
NCover= max(Child.Chromosome); %//// <<<<<< here is an error
for S_i = 1 : length(LN)
SC = UselessSensors(S_i);
Child.Chromosome(SC) = NCover;
Flag(SC ) = 1;
end;
end;
回答(1 个)
Walter Roberson
2017-6-7
At that point, your variable named Child is not a structure.
There is not much more we can say about the situation without more code.
You should use
dbstop if error
and then run your program. When it stops, look at size(Child) and class(Child) .
Pay attention to the possibility that you initialized
Child = [];
and then have code that you think should always assign a structure to Child: if for some reason it does not assign a structure to Child then you would encounter that error because Child would not be a structure.
4 个评论
Mustafa Nadhim
2017-6-7
Mustafa Nadhim
2017-6-8
Image Analyst
2017-6-8
Put this line before the error and tell us what shows in the command window:
whos Child
Walter Roberson
2017-6-8
To go beyond that we would need to see the code.
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!