Run MATLAB executable from Python
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi All,
I have an executable file (main.exe) which reads user-input from input.ini and also uses the other files below.

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 Commenti
Deepa Maheshvare M.
il 21 Dic 2022
Modificato: Deepa Maheshvare M.
il 21 Dic 2022
Al Danial
il 29 Dic 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
Risposte (0)
Vedere anche
Categorie
Scopri di più su Call Python from MATLAB in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!