"Unsupported datatype returned from MATLAB" with use of MATLAB Engine for Python
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
SAMUEL HEROY
am 20 Okt. 2014
Kommentiert: SAMUEL HEROY
am 29 Okt. 2014
Hello, It seems the "Engine for Python" is fairly new or not often used since there is very little discussion about it here or anywhere else. I'm running a MATLAB code that generates very large sparse matrices (binary entries ~30,000 by 30,000, stored as a sparse matrix). I need to run a python code on this data, and I need to do this a lot of times. The problem is that since the MATLAB code generates a matrix, Python doesn't know what to do. The tutorial on this subject demonstrates how to manually create python variables from MATLAB arrays, but there's nothing on matrix outputs from functions. Currently, when I issue the commands in Python:
import matlab.engine eng = matlab.engine.start_matlab() eng.mainf(3.0,0,10)
I get: TypeError: unsupported datatype returned from MATLAB
Any thoughts?
Akzeptierte Antwort
Robert Snoeberger
am 20 Okt. 2014
Does your function mainf return a sparse matrix? The documentation lists sparse array in unsupported MATLAB types:
1 Kommentar
Sarah Palfreyman
am 20 Okt. 2014
Bearbeitet: Sarah Palfreyman
am 20 Okt. 2014
True, as of R2014b there is not support for sparse storage types, and you can use issparse to check your data type. To use sparse data, recast the data to a matrix using full prior to passing it to the Python Engine. Generally speaking a MATLAB matrix of double values is returned to Python as matlab.double.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Call MATLAB from Python finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!