I am calling function in GA Program but getting error
古いコメントを表示
[c,d]=crossover(a,b)
Data of crossover.m file is as under % Crossover operator
function [c,d]=crossover(a,b)
nn=length(a)-1;
% generating a random crossover point
cpoint=floor(nn*rand)+1;
c=[a(1:cpoint) b(cpoint+1:end)];
d=[b(1:cpoint) a(cpoint+1:end)];
end
% end for crossover
when i run the program i get this in return from command prompt "Error: File: GA.m Line: 169 Column: 2 This statement is not inside any function. (It follows the END that terminates the definition of the function "bintodec".)"
Please tell where the problem
5 件のコメント
KSSV
2016 年 10 月 10 日
How you have named your file which has this function?
Bilal Khurshid
2016 年 10 月 10 日
Bilal Khurshid
2016 年 10 月 10 日
KSSV
2016 年 10 月 10 日
When I run the above function, I am not getting any error.
Bilal Khurshid
2016 年 10 月 10 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Genetic Algorithm についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!