python - 是否可以在 Octave 中使用 Python 模块?

标签 python octave

我想用 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/

相关文章:

package - 无法加载在 share\octave\packages 中可用但未在 share\octave\octave_packages 中列出的包

function - 有人可以解释函数 mkpp 和 ppval 的行为吗?

octave - 在向量中搜索特定字符串( Octave )

python捕获异常

python - Pandas 中的外部连接三个数据帧不起作用

python - 是什么导致我的 Python 代码在编译时出现 AttributeError?

python - 从字符串列表中获取子字符串与某个正则表达式匹配的子字符串列表

c++ - Release模式工作正常但 Debug模式给出未处理的异常 - 使用 Octave DLL

performance - 以更干净/更有效的方式过滤数据

python - 在python中重命名单个文件