Handle Data Returned from MATLAB to Python

When MATLAB® functions return output arguments, MATLAB converts the data into equivalent Python® data types.

MATLAB Output Argument Type
(scalar unless otherwise noted)

Resulting Python Data Type

Numeric array

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

double
single

float

Complex (any numeric type)

complex

int8
uint8
int16
uint16
int32

int

uint32
int64
uint64

int
long

NaN

float('nan')

Inf

float('inf')

logical

bool

char array (1-by-N, N-by-1)
char array (M-by-N)

str
Not supported

structure

dict

Row or column cell array

list

M-by-N cell arrayNot supported

MATLAB handle object (table, containers.Map, categorical array)

Not supported

Other object (e.g., Java®)Not supported

Function handle

Not supported

Sparse array

Not supported

String arrayNot supported

Structure array

Not supported

Related Topics