How does Python package generated in Matlab allow for "import matlab"?
1 view (last 30 days)
Show older comments
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 Comments
Janak Thotakura
on 10 Aug 2018
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?
Answers (0)
See Also
Categories
Find more on Python Package Integration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!