I have used the following commands to load in a python .pkl file in MATLAB:
fid = py.open("data.pkl");
data = py.pickle.load(fid);
T = table(data);
This loads a python DataFrame object and attempts to convert it to a table (newer versions of MATLAB have the ability to convert this object to a table using the table command). The table conversion produced the below error:
Error using py.pandas.DataFrame/table
Dimensions of the key and value must be the same, or the value must be scalar.
What does this error mean? I'm guessing it's because the DataFrame object in the .pkl contains a couple nested fields. Most of the fields are simply 1xN numeric vectors, but a couple are 1xN objects which then have their own fields.
I do have a .mat file produced in python by simply reading the .pkl and saving using sio.savemat, so I know that the original pkl file is valid. I would like to be able to read these files directly into MATLAB though rather than have the extra step of saving a mat file.
How can I convert this DataFrame object to something usable in MATLAB? I was given this datafile and did not generate it, and I am much more proficient in MATLAB than python, so I would rather solve this within MATLAB rather than having to create a python script or change how the file is created.