I'm making a soft that call matlab functions, and i want to pass a dict as argument in a matlab function using matlab.engine in python.
Like this:
def Parametrize(confFile):
""" Return
Argument:
confFile -- str() Configuration File path
Function that call MatLab function passing handles structure/dict as
argument. The return value of MatLab function called Parametrize(handles)
is the modified handles structure.
"""
print("ouai")
test = dict()
keys = range(4)
values = ["Hi", "I", "am", "John"]
for i in keys:
test[str(i)] = values[i]
eng = matlab.engine.start_matlab()
eng.addpath(vssFolderPath)
res = eng.Transit(test)
print(type(res))
print(res)
And the matlab function is pretty basic i'm testing how to pass data from Python to Matlab:
function a = Transit(test)
field = 'Value1';
value = {'TEST'};
disp(test)
a = struct(field,value);
i always have this error :
ValueError: invalid field for MATLAB struct
But i read this document that explain how to pass data from python to matlab and i don't know why it's not working for me.