将 MATLAB 代码转换为 Python 的工具 [英] A tool to convert MATLAB code to Python

查看:199
本文介绍了将 MATLAB 代码转换为 Python 的工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆来自我的 MS 论文的 MATLAB 代码,我现在想将它们转换为 Python(使用 numpy/scipy 和 matplotlib)并作为开源分发.我知道 MATLAB 和 Python 科学库之间的相似性,手动转换它们不会超过两周(前提是我每天都为此努力一段时间).我想知道是否已经有任何工具可以进行转换.

I have a bunch of MATLAB code from my MS thesis which I now want to convert to Python (using numpy/scipy and matplotlib) and distribute as open-source. I know the similarity between MATLAB and Python scientific libraries, and converting them manually will be not more than a fortnight (provided that I work towards it every day for some time). I was wondering if there was already any tool available which can do the conversion.

推荐答案

有多种工具可以将 Matlab 转换为 Python 代码.

There are several tools for converting Matlab to Python code.

唯一看到最近活动(2018 年 6 月的最后一次提交)是 Small Matlab to Python 编译器(也在此处开发:SMOP@chiselapp).

The only one that's seen recent activity (last commit from June 2018) is Small Matlab to Python compiler (also developed here: SMOP@chiselapp).

其他选项包括:

  • LiberMate:从 Matlab 转换为 Python 和 SciPy(需要 Python 2,上次更新于 4 年前).
  • OMPC:Matlab 到 Python(有点过时).
  • Mat2py:Matlab 到 Python(需要 Python 2).
  • LiberMate: translate from Matlab to Python and SciPy (Requires Python 2, last update 4 years ago).
  • OMPC: Matlab to Python (a bit outdated).
  • Mat2py: Matlab to Python (Requires Python 2).

另外,对于那些对两种语言之间的接口和转换感兴趣的人:

Also, for those interested in an interface between the two languages and not conversion:

  • pymatlab:通过将数据发送到 Python 进行通信MATLAB 工作区,使用脚本对其进行操作并提取结果数据.
  • Python-Matlab 虫洞:支持双向交互.
  • Python-Matlab 桥:在 Python 中使用 Matlab,为 iPython 提供 matlab_magic, 从 ipython 中执行普通的 matlab 代码.
  • PyMat:从 Python 控制 Matlab 会话.
  • pymat2:延续看似废弃的 PyMat.
  • mlabwrapmlabwrap-purepy:使 Matlab 看起来像 Python 库(基于 PyMat).
  • oct2py (repository):从 Python 中运行 GNU Octave 命令.
  • pymex:嵌入 PythonMatlab 中的解释器,也在 文件交换.
  • matpy:通过多种方式访问​​ MATLAB:创建变量、访问.mat 文件,直接连接到 MATLAB 引擎(需要安装 MATLAB).
  • MatPy:用于数值线性代数和绘图的 Python 包,具有​​类似 MatLab 的界面.
  • pymatlab: communicate from Python by sending data to the MATLAB workspace, operating on them with scripts and pulling back the resulting data.
  • Python-Matlab wormholes: both directions of interaction supported.
  • Python-Matlab bridge: use Matlab from within Python, offers matlab_magic for iPython, to execute normal matlab code from within ipython.
  • PyMat: Control Matlab session from Python.
  • pymat2: continuation of the seemingly abandoned PyMat.
  • mlabwrap, mlabwrap-purepy: make Matlab look like Python library (based on PyMat).
  • oct2py (repository): run GNU Octave commands from within Python.
  • pymex: Embeds the Python Interpreter in Matlab, also on File Exchange.
  • matpy: Access MATLAB in various ways: create variables, access .mat files, direct interface to MATLAB engine (requires MATLAB be installed).
  • MatPy: Python package for numerical linear algebra and plotting with a MatLab-like interface.

顺便说一句,在此处查看其他迁移提示可能会有所帮助:

Btw might be helpful to look here for other migration tips:

另一方面,对于可能会发现它有用的人来说:

On a different note, for people who might find it useful there is:

这篇关于将 MATLAB 代码转换为 Python 的工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆