algorithm - 遗传算法中的错误( Octave )

标签 algorithm matlab compiler-errors octave genetic-algorithm

我正在尝试在 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/

相关文章:

matlab - Matlab 中的并行处理

matlab - Simulink 中这个图标的含义是什么?

java - 为什么最后一行出现语法错误?

C++默认赋值运算符

c++ - Sieve of Sundaram 和 Sieve of Atkin 生成素数列表的比较

c# - 获取给定数字 + c# 的 2 的幂之和

algorithm - 如何在平衡二叉搜索树中保持最小和最大花费 O(1) 时间,而不用指针乱搞?

algorithm - 我们如何改进归并排序算法?

matlab - 如何从另一个 gui 调用 MATLAB gui 中的回调函数?

excel - 语法错误CountIfs函数多个条件