【发布时间】:2023-03-06 11:25:01
【问题描述】:
我觉得我快到了,但需要额外的推动!我正在尝试从 Python 调用 MATLAB 脚本(我不担心 MATLAB 脚本的输出 - 它独立运行)。但是,我必须能够将输入从 python 发送到 MATLAB 脚本。
现在我有(在 python 中):
myvartoinput = 55
cmd = 'myscript.m'
process = Popen(["matlab", "-nosplash", "-nodesktop", "-r", cmd], shell=True)
process.communicate()
# Also, how do i 'exit' the MATLAB so it doesn't continue to run
我不确定如何将“myvartoinput”添加到“myscript.m”文件中。另外,我是否正确调用了脚本?最后,我希望它“退出”,这样它就不会在我的电脑的后台保持打开状态。任何帮助将不胜感激!
【问题讨论】:
标签: python matlab arguments subprocess popen