Pass Data Between MATLAB and Python
Pass Data from MATLAB to Python
When MATLAB® functions return output arguments, MATLAB converts the data into equivalent Python® data types.
MATLAB Output Argument Type | Resulting Python Data Type |
---|---|
Numeric array |
|
|
|
Complex (any numeric type) |
|
|
|
|
|
|
|
|
|
|
|
struct scalar |
|
cell array (1-by- |
|
dictionary |
|
MATLAB handle object (such as the
|
MATLAB returns a reference to a |
MATLAB value object (such as the | Opaque object. You can pass a value object to a MATLAB function, but you cannot create or modify it. |
Other object (for example, Java® object) | Not supported |
Function handle | Not supported |
Sparse array | Not supported |
|
|
Pass Data from Python to MATLAB
When you pass data as input arguments to MATLAB functions from Python, MATLAB converts the data into equivalent MATLAB data types.
Python Input Argument Type | Resulting MATLAB Data Type |
---|---|
| Numeric array |
|
|
| Complex |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| struct |
| dictionary |
| Cell array |
| Cell array |
| Cell array |
Objects that support the buffer protocol, such as | Numeric array |
| Not supported |
| Not supported |