我想用 Python 为 Octave 编写函数。谷歌没有帮助确定是否有可能以某种方式在 Octave 中导入/包含/任何 Python 模块,并将它们调用为就好像它们是 native .m 函数一样。我查看了 Cython,它从 Python 创建 C 源代码,但它使用 Python 对象作为参数和返回类型。是否可以在 Octave 中使用 Python 模块?
最佳答案
不幸的是,没有直接的方法可以做到这一点。
然而,始终可以运行 Python 程序并解析输出。事实上
You can execute any shell command using the function system (cmd, flag). The second argument is optional. If it is present, the output of the command is returned by system as a string. If it is not supplied, any output from the command is printed, with the standard output filtered through the pager.
例如:
output = system ("python /home/user/some_algoritmh.py", 1)
关于python - 是否可以在 Octave 中使用 Python 模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6263027/