我正在尝试在 Octave 中实现遗传算法。
我的代码是http://codepad.org/NeaWqa90
我收到以下错误:
>> run("a.m")
parse error near line 31 of file /home/teron/a.m
nested functions not implemented in this context
>>> function [x,y]=crossover(x,y)
^
error: called from 'run' in file /usr/share/octave/4.0.0/m/miscellaneous/run.m near line 84, column 5
>>
我不知道如何解决这个错误
最佳答案
该错误相当有用,即有关“嵌套函数”的部分。例如,以下给出了相同的错误。
function fun1
function fun2
end
end
将其保存到文本文件(例如
temp.m
)中,然后运行它。octave:2> run('temp.m')
parse error near line 3 of file /home/me/temp.m
nested functions not implemented in this context
>>> function fun2
^
error: called from 'run' in file /usr/share/octave/3.8.1/m/miscellaneous/run.m near line 80, column 5
我怀疑您在第13行附近缺少
end
,但是格式正确的代码将大有帮助。
关于algorithm - 遗传算法中的错误( Octave ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35902578/