struct contents reference from a non-struct array object [Help Please]
Show older comments
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;
Answers (1)
Walter Roberson
on 7 Jun 2017
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 Comments
Mustafa Nadhim
on 7 Jun 2017
Mustafa Nadhim
on 8 Jun 2017
Image Analyst
on 8 Jun 2017
Put this line before the error and tell us what shows in the command window:
whos Child
Walter Roberson
on 8 Jun 2017
To go beyond that we would need to see the code.
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!