Run MATLAB executable from Python
조회 수: 3 (최근 30일)
이전 댓글 표시
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
Al Danial
2022년 12월 29일
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!