Command Window output using Matlab engine in Python
조회 수: 22 (최근 30일)
이전 댓글 표시
I want to be able to see the output printed in the Command Window in real-time while running a script using the Matlab engine in Python (I'm using the Spyder IDE). I've tried two approaches:
Approach 1:
I've started the Matlab engine with desktop using using the following commands:
eng = matlab.engine.start_matlab()
eng.desktop(nargout=0)
The desktop shows up, however all the output that should show in the Matlab Command Window when I run a Matlab script gets printed in the Spyder IDE console.
Approach 2:
Redirecting the standard output and error from Matlab to Python as described here: https://www.mathworks.com/help/matlab/matlab_external/redirect-standard-output-and-error-to-python.html
When using the approach from this Mathworks example, I have to wait for the Matlab script to finish running to see the output, so it doesn't work in real-time.
Does anyone know how I can make this work using either of these approaches or know of a different way of doing this? I am making a GUI using Pyside that can run some data processing with Matlab, but I want to see the progress printed by the Matlab script as it's running. With approach 2, I would just print the Matlab output to a QTextEdit in Pyside
댓글 수: 1
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Call MATLAB from Python에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!