Having an error of function handler while using GA

Hello everybody,
I have started using GA toolbox in matlab. When I want to run my code, it gives me the following error:
Error using functionHandleOrCell (line 13) The constraint function must be a function handle.
I dont really know what this means. I have a custom fitness function:
fun = @(chrom) fitnessfunction(chrom,lcap, lcapmain, cl, clmain, nump, ind, alpha, o, OD, tw,nc_nodes,nc,allnode, pc, dem, nt,x);
and I used fun in : [X fval] = ga(fun,gensize,[],[],[],[],LB,UB,options);
Chrom is my population. I will appreciate if you can help me.
Thanks

 채택된 답변

Sean de Wolski
Sean de Wolski 2014년 2월 27일
Run the following:
dbstop if error
This will stop when the error is thrown so you can inspect what's going on and which variable is not what you expect it to be.

댓글 수: 1

Thank you for you information. The point is I know where the error happens (I know the function which shows the error) but I dont understand why because it doesnt specifically show which function is not working properly.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Parallel Computing에 대해 자세히 알아보기

태그

질문:

2014년 2월 27일

댓글:

2014년 2월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by