Use python functions in packages created with MATLAB Compiler SDK

조회 수: 3 (최근 30일)
Christopher Wunder
Christopher Wunder 2022년 4월 7일
댓글: Ayush 2023년 10월 16일
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
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 CenterFile Exchange에서 MATLAB Compiler SDK에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by