作者MicroPtt (Mission Start)
看板Python
標題[問題] 如何從Python呼叫Matlab執行
時間Fri Mar 13 23:04:07 2009
我目前找到兩種方法
A. Pymat
http://claymore.engineer.gvsu.edu/~steriana/Python/pymat.html
可惜只支援Python2.2和Matlab6.5之間的橋樑
B. mlabwrap
http://mlabwrap.sourceforge.net/
支援到Python2.5和Matlab7.0
我本身是需要用到Python2.5,最近有一個問題就是mlabwrap它不象Pymatㄧ樣
有一個eval(handle, string)函式可以類似直接輸入指令在Matlab commend
it is as if you had typed the string directly in MATLAB's
command window.
因為我只需要從Python呼叫Matlab然後執行我要的M檔案.
ex:這個方法可以在打開Matlab後直接在命令列輸入我要的檔名a123.m並執行
但是mlabwrap沒有eval指令我該怎麼辦呢???
簡單的說我只要用Python2.5(mlabwrap函式庫)執行matlab檔案...
有人知道怎麼辦嘛?
--
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.118.206.43
→ blc:os.system('matlab a123.m') (被扁) 03/13 23:35
→ MicroPtt:忘了說不是只有開啟m檔案就好,還要自動執行XD 03/14 00:33
推 coeric:改用numpy吧~~ 03/14 12:25
推 scan33scan33:os.popen('matlab') <- 我愛popen,還可接return值 03/27 22:38
推 sandaniel:os.popen2('matlab -nosplash -nodesktop -r fn(5)') 05/09 11:45
→ sandaniel:不過手動關掉matlab視窗值才傳的回來。 05/09 11:46
→ sandaniel:傳回來的值是字串,還包含開頭的歡迎訊息 >_< 05/09 11:47