Convert Matlab engine outputs to numpy arrays

When I use MATLAB engine for python, the outputs of functions are not numpy arrays. Rather, they are matlab engine variables. Since there is not much to be done with those variable types in python, unless the variables are converted to numpy arrays, I was wondering if there is a [fast] way to convert them to numpy arrays.

Respuestas (1)

Stephen23
Stephen23 el 1 de Mzo. de 2017
Editada: Stephen23 el 1 de Mzo. de 2017
The MATLAB Engine for Python:
returns these data classes in Python:
All of these can be handled by numpy, so it should be possible to call numpy.asarray:
np.asarray(output_array)
As an alternative, try this method:

Categorías

Etiquetas

Preguntada:

el 1 de Mzo. de 2017

Comentada:

el 11 de Jul. de 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by