the program is working perfectly but when i am changing it to function the follwing error is beeing displayed:
[Parent1index, Parent1Position, alldcel] = Parent1n(TotalnoOfGrids, noOfNodes, Penalties, test)
??? Index exceeds matrix dimensions.
Error in ==> Parent1n at 10
[~,index]=min(alldcel{t});
ok with this code the functiion worked:
if Penalties{t}(r)> 0;but interchanging if statement with else did notalldcel {t}(r)=alldcel{t}(r);
else alldcel {t}(r)=inf;