Attempt to reference field of non-structure array error message while running genetic algorithm code
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Priya Dharshini
el 8 de Mayo de 2016
Comentada: Walter Roberson
el 11 de Mayo de 2016
While running my genetic algorithm code i'm getting the following errors
Attempt to reference field of non-structure array.
Error in setwb (line 23)
inputLearn = net.hint.inputLearn;
Error in rmse_test (line 17)
net = setwb(net,x');
Error in @(x)rmse_test(x,{net,inputs,targets})
Error in createAnonymousFcn>@(x)fcn(x,FcnArgs{:}) (line 11)
fcn_handle = @(x) fcn(x,FcnArgs{:});
Error in fcnvectorizer (line 14)
y(i,:) = feval(fun,(pop(i,:)));
Error in makeState (line 47)
Score = fcnvectorizer(state.Population(initScoreProvided+1:end,:),FitnessFcn,1,options.SerialUserFcn);
Error in gaunc (line 41)
state = makeState(GenomeLength,FitnessFcn,Iterate,output.problemtype,options);
Error in ga (line 351)
[x,fval,exitFlag,output,population,scores] = gaunc(FitnessFcn,nvars, ...
Error in genetic_algorithm (line 55)
[x_ga_opt, err_ga] = ga(h, 3, ga_opts);
Caused by:
Failure in user-supplied fitness function evaluation. GA cannot continue.
Can someone help me how to solve this error and make this code run properly...??
I have attached my code and data here
0 comentarios
Respuesta aceptada
Walter Roberson
el 8 de Mayo de 2016
You coded
h = @(x) rmse_test(x, {net, inputs, targets});
but rmse_test expects (x, net, inputs, targets) as separate variables.
8 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!