从 python 调用 MATLAB 函数 [英] Calling MATLAB functions from python

查看:41
本文介绍了从 python 调用 MATLAB 函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 Python 中运行 MATLAB 函数?我在互联网上搜索,我只能找到 PyMat.不好的是编译版本只支持Python2.2,我用的是2.6.所以我试着下载了源代码,这样我就可以自己编译了.但是我无法编译它,VC++ express 似乎没有编译它所需的功能.谁有PC版的编译版?或任何 PyMat 的替代品?谢谢

解决方案

PyMat 看起来已经被废弃了.

我假设您使用的是 Windows,因此您始终可以采用最简单的方法并使用 Matlab 的 COM 接口:

<预><代码>>>>导入 win32com.client>>>h = win32com.client.Dispatch('matlab.application')>>>h.Execute ("plot([0 18], [7 23])")>>>h.执行(1+1")你' ans = 2 '

更多信息这里

Is it possible to run MATLAB functions from within Python? I search the internet, I could only find PyMat. The bad thing is the compiled version only supports Python2.2 and I am using 2.6. So I tried to download the source code, so I can compile it for myself. But I cannot compile it, VC++ express seems not to have the necessary functionalities to compile it. Does anyone have the compile version for PC? or any substitutes for PyMat? Thanks

解决方案

PyMat looks like it's been abandoned.

I'm assuming you are on windows so you could always do the simplest approach and use Matlab's COM interface:

>>> import win32com.client
>>> h = win32com.client.Dispatch('matlab.application')
>>> h.Execute ("plot([0 18], [7 23])")
>>> h.Execute ("1+1")
u'
ans =

     2

'

More info here

这篇关于从 python 调用 MATLAB 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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