Main Content

Import CompiledPythonPackages

TheMATLAB®Compiler SDK™Python®target generates the Python code into a package that must be imported into Python before you can use the compiled MATLAB functions. You specify the package name and the namespace when compiling the MATLAB functions.

  • If you use the Library Compiler app, you specify the package name with theLibrary Namefield and the namespace with theNamespacefield.

    TheLibrary Namefield defaults to the name of the first MATLAB file listed in the app. You can leave theNamespacefield empty.

  • If you use themccfunction, you specify the package name and namespace as part of the-W python:namespace.packageNameflag.

    Specifying the namespace is optional.

For example, if you compile your MATLAB functions and specify the package name asaddmatrixwith no namespace, you import it as follows:

import addmatrix

If you compile your MATLAB functions using themcccommand with the option-W python:com.mathworks.addmatrix, you import it as follows:

import com.mathworks.addmatrix

Related Topics