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

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

问题描述

是否可以在Python中运行MATLAB函数? 我在互联网上搜索,只能找到PyMat.不好的是,编译版本仅支持Python2.2,而我使用的是2.6.因此,我尝试下载源代码,以便自己进行编译.但是我不能编译它,VC ++ express似乎没有编译它所必需的功能.有人有PC的编译版本吗? 还是PyMat的替代品? 谢谢

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似乎已被废弃.

PyMat looks like it's been abandoned.

我假设您在Windows上,因此您始终可以采用最简单的方法并使用Matlab的COM界面:

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'\nans =\n\n     2\n\n'

更多信息此处

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

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