【发布时间】:2015-05-14 21:51:29
【问题描述】:
有没有办法从 Python 2.7 Shell 或 .py 代码运行 Matlab.m 文件?我尝试使用以下代码:
import os
os.chdir(r'D:\The_folder_where_the_file_is')
os.startfile("The_desired_Matlab_file.m")
但是,它只是打开 .m 文件,而不运行它(就像您在编辑器 Matlab 中按 F5 时一样)。我该怎么办?
(我已经下载了 pymat 和 win32,如果有帮助的话)
【问题讨论】:
-
在 Python 中使用 -r 选项运行 MATLAB 的示例可以在 here 中找到