Retrieve python object with matlab -


i have pickled dictionary python. want use values of dictionary on matlab code. possible?

dictionaries in matlab can used in following way:

keys={'a','b','c'}; values={5,6,7}; c = containers.map(keys,values); c =     containers.map handle   package: containers    properties:         count: 3       keytype: 'char'     valuetype: 'double' 

so can generate .m file python following (considering both key , values real numbers ) :

keys="keys = {"+",".join([str(k) k in python_dict])+"};"  values="values = {"+",".join([str(python_dict[k]) k in python_dict])+"};"  fh=open("mfile.m","w")  fh.write("%s\n%s\n" % (keys,values))  fh.write( "c = containers.map(keys, values);\n")   fh.close() 

and later can load file in matlab.


Comments