python package using matlab object handle

3 views (last 30 days)
Ryvo Octaviano
Ryvo Octaviano on 15 Mar 2020
Commented: Pri_Comet on 27 May 2021
Dear All,
I would like to compile my matlab function to python package library. Thus, I make a function parser , i.e. loadObject, printObject, etc. from my matlab object handle.
However, is it possible to pass matlab object handle using matlab struct for python? I remember, I did that for my implementation in C using mwArray. Is there any similar library?
I can't using matlab engine since it requires matlab license
Thank you,
Ryvo Octaviano
function var = loadObject()
var.obj = matlabClass();
end
function printObject(var)
printObject(var.obj);
end
classdef matlabClass < handle
properties
a = 1;
end
methods
function obj = matlabClass()
end
function printObject(obj)
disp(obj.a)
end
end
end
function TestScript()
var = loadObject();
printObject(var);
end
I got this error:
Traceback (most recent call last):
File "loadObjectSample.py", line 15, in <module>
varOut = my_TESTJava.loadObject()
File "C:\Program Files\MATLAB\MATLAB Runtime\v96\toolbox\compiler_sdk\pysdk_py\matlab_pysdk\runtime\deployablefunc.py", line 80, in __call__
nlhsWasSpecified, stdoutObj, stderrObj).result()
File "C:\Program Files\MATLAB\MATLAB Runtime\v96\toolbox\compiler_sdk\pysdk_py\matlab_pysdk\runtime\futureresult.py", line 135, in result
raise e
File "C:\Program Files\MATLAB\MATLAB Runtime\v96\toolbox\compiler_sdk\pysdk_py\matlab_pysdk\runtime\futureresult.py", line 123, in result
raise e
File "C:\Program Files\MATLAB\MATLAB Runtime\v96\toolbox\compiler_sdk\pysdk_py\matlab_pysdk\runtime\futureresult.py", line 113, in result
self._nlhs, out=self._out, err=self._err)
matlab_pysdk.runtime.MatlabRuntimeError: An error occurred when evaluating the result from a function. Details: invalid map<K, T> key
  2 Comments
wallflower
wallflower on 30 Dec 2020
Have you found the solution to your problem? I am dealing with it too...
Pri_Comet
Pri_Comet on 27 May 2021
Facing the same issue here. Would love to know if you've found a solution.

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB Compiler SDK in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!