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.

답변 (1개)

Stephen23
Stephen23 2017년 3월 1일
편집: Stephen23 2017년 3월 1일

4 개 추천

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:

카테고리

도움말 센터File Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

태그

질문:

2017년 3월 1일

댓글:

2018년 7월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by