Installing MATLAB Engine API for Python

조회 수: 5 (최근 30일)
Deepa Maheshvare
Deepa Maheshvare 2020년 11월 3일
댓글: Ameer Hamza 2020년 11월 3일
Hi,
I'm going through the documentation available here https://in.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html to install matlab engine in python.
I did
cd "matlabroot\extern\engines\python"
after which I have to do
python setup.py install
But I am not sure what has to be done when there are multiple python versions installed. How can I specify the path to the python version / virtuen env in which I want to set up the matlab engine in the command `python setup.py install`?
Suggestions will be useful

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 11월 3일
편집: Ameer Hamza 2020년 11월 3일
Activate the virtual environment and then run these line
cd "matlabroot\extern\engines\python"
python setup.py install
Alternatively, you can also try the following without activating the environment
cd "matlabroot\extern\engines\python"
/path/to/virtualenv/python setup.py install
but this second option can cause some issues.
  댓글 수: 2
Deepa Maheshvare
Deepa Maheshvare 2020년 11월 3일
Hi, the first option worked for the installation.
After I try,
eng = matlab.engine.start_matlab()
eng.main()
returns
\Python\Python36\lib\site-packages\matlab\engine\fevalfuture.py", line 82, in result
self._result = pythonengine.getFEvalResult(self._future,self._nargout, None, out=self._out, err=self._err)
matlab.engine.MatlabExecutionError: Too many output arguments.
main function looks something like the below
function main()
create_stuff();
simulate();
end
I am not sure why the above error is returned.
Suggestions will be helpful.
Ameer Hamza
Ameer Hamza 2020년 11월 3일
Try this
eng = matlab.engine.start_matlab()
eng.main(nargout=0)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by