Use python functions in packages created with MATLAB Compiler SDK

4 Ansichten (letzte 30 Tage)
Christopher Wunder
Christopher Wunder am 7 Apr. 2022
Kommentiert: Ayush am 16 Okt. 2023
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 Kommentar
Ayush
Ayush am 16 Okt. 2023
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

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu MATLAB Compiler SDK finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by