Reading python pickle of dict in MATLAB causes error

11 views (last 30 days)
BABA CHOUDHURY on 11 Mar 2021
Answered: Asvin Kumar on 15 Mar 2021
I have a pickle file of a python dictionary whose keys are tuples `(10, 11), (10, 12), (11, 10), (11, 12), (12, 10), (12, 11)`.
I use the following commands to read them
fid ='file.pickle','rb');
data = py.pickle.load(fid);
At this point, I think the code is working correctly as
in MATLAB gives the correct answer as
dict_keys([(10, 11), (10, 12), (11, 10), (11, 12), (12, 10), (12, 11)])
The equivalent of dict in python is structures ([1]) so when I try to convert it to `struct` using
, I get an error as
Error using py.dict/struct
Field names must be non-empty character vectors or a string
What does the error mean here?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!