Pass Data to MATLAB from Python

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
(scalar unless otherwise noted)

matlab numeric array object (see MATLAB Arrays as Python Variables.

Numeric array

float

double

complex

Complex double

int

int32(Windows®)

int64(Linux® and Mac)

long [a]

int64

float('nan')

NaN

float('inf')

Inf

bool

logical

str

char

bytearray

uint8 array

bytes

uint8 array

dict

Structure if all keys are strings
Not supported otherwise

list

Cell array

set

Cell array

tuple

Cell array

memoryview

Not supported

range

Cell array

None

Not supported

module.type

Not supported

[a] 

long is a data type of Python 2.7 only

Related Topics

Was this topic helpful?