我尝试使用python脚本启动 simulink 模拟(mlabwrap为matlab的python包装器)。我使用:
打开simulink * .mdl文件open_system("thermo","loadonly");
我使用set_param初始化模拟:
set_param("thermo", 'SimulationCommand', 'start');
这会引发以下错误:
更改模拟执行状态时发生错误。 如果内存分配失败或者没有X连接,可能会发生这种情况
如果我只是执行sim("thermo")
,一切正常。
不幸我想使用set_param 而不是sim。
如何在没有X服务器的情况下使用set_param("thermo", 'SimulationCommand', 'start');
并从终端运行它?
我在Ubuntu上使用Matlab2009b。
修改
事实证明,如果我以X服务器的用户身份运行模拟,即使使用 set_param ,一切也能正常运行......
但我仍然想知道,如果可以在没有运行X服务器的情况下运行模拟......
答案 0 :(得分:1)
事实证明,如果没有X服务器,您无法使用 set_param 开始模拟:
"If you use matlab -nodisplay to start a session, you cannot use set_param to run your simulation."
编辑:官方文档链接(如@Daniel指出)