How does Python package generated in Matlab allow for "import matlab"?
1 次查看(过去 30 天)
显示 更早的评论
I am developing a Python package from my Matlab functions using Matlab Compiler SDK within R2018a. I used this tutorial. I got the basic functionality down and executed the functions in Python, but I am now working on input/outputs data types. Some of the help files reference the Matlab array classes via 'import matlab' in python. For example, a Python code might look like:
import PythonSimple
import matlab
a = matlab.double([[1,2,3], [4,5,6]])
blah = PythonSimple.initialize()
print(blah.python_trial(a))
blah.terminate()
where PythonSimple is Python package I compiled from Matlab code. My question, when is the python package 'matlab' installed for python. ie. Why is it that the 'import matlab' works on my machine even though I never had to do a 'pip install matlab' or equivalent? Do I need Matlab on my machine to call 'import matlab' or does the matlab package get installed for Python when I install my compiled packages Python simple (python PythonSimple.py install)? I need to know because the systems on which I eventually will deploy PythonSimple will not have Matlab installed, but it would be helpful if I could use the matlab package Python data types within my Python scripts to simplify the input/output data type conversions.
Thanks.
2 个评论
Janak Thotakura
2018-8-10
The workflow mentioned in the below link should have installed all the required files.
https://www.mathworks.com/help/compiler_sdk/python/install-a-matlab-compiler-sdk-python-package.html
Can you confirm if you have used python setup.py install? Or are you following a different workflow?
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Python Package Integration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!