I am translating code from matlab to python. I am using matlab engine provided by mathworks to partially call chunks of the old matlab code in the midst of what it has already been translated to python.
For example:
//python already translated code
x = matlabEngineObject.matlab_function_example_1(arg1)
//more python already translated code using x
y = matlabEnginObject.matlab_function_example_2(x)
//more python
Following my code example, my problem is that in Windows I cannot pass x as argument to the second matlab function if it is an instance of matlab.double, which makes no sense because I think that is the main goal of that data type.
However, in Linux Ubuntu I can do it without trouble. I generally work in Linux Ubuntu but I need the code to run in Windows too.
The error I get trying to pass a matlab.double to a matlab function through a matlab engine is the one below
>>> b = eng.test2(matlab.double([1,2]))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Tomas
Pastore\AppData\Local\Programs\Python\Python35\lib\site-
packages\matlab\engine\matlabengine.py", line 79, in __call__
out=_stdout, err=_stderr)
TypeError: unsupported Python data type: matlab.double
I checked python versions between the two systems -> both 3.5.2 I have also checked matlab versions, they are both R2017a, the only difference is the arch because of the OS I guess (linux is glnxa64 and windows is win64).
The only difference I found between both environments is that printing this object class name, in linux I get mlarray.double instead of matlab.double in windows. However, in both systems this data type is returned by the same constructor, ej: matlab.double([1,2]).
Data type of matlab.double in Linux ubuntu (working)
Data type of matlab.double in Windows (not working)
Last, I can say that other features of the engine are working correctly in windows as I tested other functions and they work fine.
My doubts are:
1) Why does the same version of python output a different type for the same object.
2) How can I get matlab.double get accepted by matlab engine in windows.
Thanks in advance