Reputation: 17871
How do I call commands in a Matlab terminal when it's opened through Python? I call this:
subprocess.call(["matlab", "-nosplash", "-nodesktop", "-r"], shell=True)
which opens a terminal window. But how can I send new commands in there? I tried simply adding them to the current call, but they don't execute.
Upvotes: 0
Views: 242
Reputation: 17871
This worked for me:
subprocess.call(["matlab", "-nosplash", "-nodesktop", "-r", "command1;command2;"], shell=True, stdin=subprocess.PIPE, stout=subprocess.PIPE)
Upvotes: 1