Limitations to Python Support
Features Not Supported in MATLAB® |
---|
Closing the Python® interpreter while running MATLAB with in-process execution mode. |
Saving (serializing) Python objects into a MAT-file. |
Passing Python objects or keyword arguments created by |
Interactive Python help (calling |
Accessing static properties of a Python class. |
MATLAB
|
MATLAB class inheritance from a Python class. |
Customized (dynamic) attribute access. |
Nested Python classes. |
Modules that start MATLAB in a separate process, for example, the
|
Modules that read |
Dynamically generated Python classes. |
Dynamically attaching new object attributes. Instead, use
|
Class names or other identifiers starting with an underscore
( |
Python modules generated by the MATLAB Compiler SDK™ product. |
Python code using Cocoa (AppKit) for user interfaces on macOS platforms. |
The size of variables passed between Python and MATLAB is limited to 2 GB when you call a Python function out-of-process. This limit applies to the data plus supporting information passed between the processes. |
Limitations to pyrun
and pyrunfile
Functions
Python classes defined using
pyrun
orpyrunfile
cannot be modified if you return an instance of the class to MATLAB. If you need to change class definitions, restart the interpreter session:terminate(pyenv) pyenv(ExecutionMode="OutOfProcess")
Alternatively, restart MATLAB for
"InProcess"
.The
pyrun
andpyrunfile
functions do not support classes with local variables that are initialized by other local variables through methods. For such usage, create a module and access it using thepy.
prefix.Type conversion based on Python type hints is not supported for
pyrun
,pyrunfile
or the Run Python Code task where native Python code is provided as input.
Unsupported MATLAB Types
These MATLAB types are not supported in Python.
Multidimensional
char
orcell
arraysSparse arrays
struct
arrayscategorical
containers.Map
MATLAB objects
matlab.metadata.Class
(py
.class
)