Hello, Any solution to run Python files through Matlab simultaneously ?

조회 수: 17 (최근 30일)
Rao
Rao 2016년 10월 2일
댓글: Rao 2016년 10월 4일
Hello, Any solution to run Python files through Matlab simultaneously ? I have developed neural network algo for my dataset classification in Python using Theano, and other libraries. But i have no time to translate all this in Matlab. I know this is possible, there exist alot of libraries (matconvnet). Help needed to run python files through Matlab. Matlab Engine API or any Solution? Or to run both simultaneously ? (E.g Lets say, Matlab sends data and Python process it and returns back to it Matlab ?) I have written Python code for my Novel Dataset classification and it classify my Data, and i want the result to be imported back in Matlab. Suggestions are appreciated.

채택된 답변

Roman Müller-Hainbach
Roman Müller-Hainbach 2016년 10월 4일
On Unix-systems I use this approach:
Use the system()-command with something like this: 'python your_python_file.py &'. The '&' at the end makes this command finish immediately while your Python script runs in the background. You can start all your python runs through a loop.
You can then check for the results (which you will probably write into some files) and start processing them when they are present.
  댓글 수: 1
Rao
Rao 2016년 10월 4일
Well, I have Windows and i tried in Matlab in this way : (a = system('python myfile_path/myPython_File.py'). After going through the system() command what you have suggested. And it works really Cool, i was not expecting earlier, but it did. Thanks alot Man.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Gareth Thomas
Gareth Thomas 2016년 10월 3일
Yes, you can call Python from MATLAB: Calling Python Libraries
Or if you want you can call MATLAB from Python: MATLAB Engine API for Python
I hope that this helps you.
  댓글 수: 1
Rao
Rao 2016년 10월 4일
Yes, i have been to MATLAB Engine API. And all other stuff too. Those were also helpful. But my work is done by simply calling (.py) file in Matlab. I have not tried this earlier, as i am a bit slothy in these stuff. But, Thanks alot for the suggestion.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by