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;

Answers (1)

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

Thank you Walter Roberson , i will try it
the same error, but when i use dbstop if error , the error shown in Parallel cause i'm using parallel processing , so how to solve it ?
Put this line before the error and tell us what shows in the command window:
whos Child
To go beyond that we would need to see the code.

Sign in to comment.

Categories

Find more on MATLAB in Help Center and File Exchange

Asked:

on 7 Jun 2017

Commented:

on 8 Jun 2017

Community Treasure Hunt

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

Start Hunting!