Run MATLAB executable from Python
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi All,
I have an executable file (main.exe) which reads user-input from input.ini and also uses the other files below.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1238337/image.png)
In MATLAB's command prompt, I run the executable like this
!main
I am not sure how to run this file from Python.
Suggestions will be of great help.
3 comentarios
Deepa Maheshvare M.
el 21 de Dic. de 2022
Editada: Deepa Maheshvare M.
el 21 de Dic. de 2022
Al Danial
el 29 de Dic. de 2022
Try it like this:
import subprocess
exe_str = "I:/sim/main/main.exe"
result = subprocess.run(exe_str, capture_output=True, text=True)
print("STDOUT=", result.stdout) # optional
print("STDERR=", result.stderr) # optional
Respuestas (0)
Ver también
Categorías
Más información sobre Call Python from MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!