http://blog.csdn.net/sunny_xsc1994/article/details/70197168
參考這篇博客系洛,非常詳盡。
安裝numpy,vc++,win32com
win32com網(wǎng):https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/
豆瓣鏡像網(wǎng)址:https://pypi.douban.com/simple
UCIwhl文件網(wǎng)址:https://www.lfd.uci.edu/~gohlke/pythonlibs/
1.簡(jiǎn)單畫(huà)圖
from mlab.releases import R2014a #或者from mlab.releases import latest_release as matlab
from matlab import matlabroot
print matlabroot()
D:/MATLAB/R2014a? ? ? ? ? ? ? ? ? ? ? ? ? #這是我的matlab安裝路徑
from mlab.releases import R2014a as mlab
mlab.plot([1,2,3], '-o')
mlab.plot([2,3,4,5,8,1],'-o')
2.運(yùn)行M文件
為了想嘗試看看能否調(diào)用那些里面又調(diào)用了別的函數(shù)文件
我特地寫(xiě)了兩個(gè)m函數(shù)顶吮,一個(gè)是read.m,里面還調(diào)用了另一個(gè)m函數(shù)文件fun.m么库,放在了C:\Tools\mlabtest文件下
from mlab.releases import latest_release as matlab
matlab.path(matlab.path(),r'C:\Tools\mlabtest') ? #the path of the read.m
data=matlab.read('input.txt') ? #執(zhí)行read函數(shù)文件跋炕,函數(shù)的參數(shù)是文件名稱,表明我要從該輸入文件中讀取數(shù)據(jù)茵肃,并返回fun.m處理后的數(shù)據(jù)
print data