Use python functions in packages created with MATLAB Compiler SDK
3 次查看(过去 30 天)
显示 更早的评论
Hi,
I'm using the Matlab Compiler SDK to create a python package and integrate it in a python application.
Now the package itself, that is the matlab code, also uses python functions from a module.
In the packaged library the py. command is not recognized and thus the module function names are not resolved.
I get a warning: Warning: Ability to call Python libraries from MATLAB is not available with MATLAB Compiler SDK for Python
Is there any possibility to include python functions in matlab code and then build the package OR do I need to remove all py. calls from my matlab code and outsource this functionality somehow?
1 个评论
Ayush
2023-10-16
Hi Christopher,
I understand that you want to use python functions in the MATLAB code and build a package around it.
The warning you received indicates that the ability to package Python libraries from MATLAB is not available with "MATLAB Compiler SDK" for Python. This means that you won't be able to directly use Python functions from within your MATLAB code when building the package. Please refer to the below documentation to know more about “Python Package Integration” in “MATLAB Compiler SDK”:
Some possible workarounds for this issue are the same as mentioned by you:
Remove py. calls from MATLAB code: Modify your MATLAB code to remove any dependencies on Python functions. This would entail rewriting the affected code in MATLAB or finding alternative MATLAB functions to achieve the same functionality.
Outsource the functionality: If the functionality provided by the Python module is critical and cannot be easily replicated in MATLAB, you can consider creating a separate Python package or module that encapsulates the required functionality. You can then call this Python package from your Python application, independent of the MATLAB Compiler SDK.
Hope it helps,
Regards,
Ayush Misra
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Compiler SDK 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!