python调用matlab的m自定义函数方法
项目信号处理和提取部分用到了matlab,需要应用到工程中方便研究。用具有万能粘合剂之称的“Python”。具体方法如下:
1.python中安装mlab
下载https://pypi.python.org/pypi/mlab
安装命令:python setup.py install
Mlab is a high-level python to Matlab bridge that lets Matlab look like a normal python library.
2 .测试
from mlab.releases import latest_release from matlab import matlabroot print matlabroot()#能打印出matlab的路径就可以使用mlab了
3.调用matlab的自带函数
from mlab.releases import latest_release as matlab matlab.plot([2,3,4,5,8,1],'-o') #画个图。很快就显示了。
4.自定义的函数
这里我把自定义的m函数(extract.m)放到了D:\pylearn\m文件夹下
from mlab.releases import latest_release as matlab matlab.path(matlab.path(),r'D:\pylearn\m')#设置路径 matlab.extract(arg1,arg2)#调用自己定义的m函数就可以了
相关推荐
cuiguanjun 2020-07-26
Canethui 2020-05-31
Canethui 2020-05-30
cuiguanjun 2020-05-14
xiaoxue 2020-05-09
cuiguanjun 2020-03-01
wwwdownmacom 2020-09-14
wanff0 2020-07-26
HongAndYi 2020-07-04
知识小屋 2020-06-24
wanff0 2020-06-14
cuiguanjun 2020-06-13
liqing 2020-06-13
algorithmlixuan 2020-06-12
faustcao 2020-06-12
GerwelsJI 2020-06-09
zyazky 2020-06-08
cuiguanjun 2020-06-05