Import Compiled Python Packages

The MATLAB® Compiler SDK™ Python® target generates the Python code into a package that must be imported to the Python runtime 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 the Library Name field and the namespace with the Namespace field.

    The Library Name field defaults to the name of the first MATLAB file listed in the app. You can leave the Namespace field empty.

  • If you use the mcc function, you specify the package name and namespace as part of the -W python:namespace.packageName flag.

    Specifying the namespace is optional.

For example, if you compile your MATLAB functions and specify the package named addmatrix, you import it as follows:

import addmatrix

Related Examples

Was this topic helpful?