Loading a Cell Array (.mat file) into Python

Viewed 4647

I have a 25x4x3 Cell Array which I have saved into a .mat file and now need to load into Python.

A simple .mat file I am familiar with, but being new to Python, this problem is a little over my head. The 25 dimensions and 4 dimensions represent integers that I need to call later in my code. The 3 dimension in the cell array contains a list of datetime arrays, data, and then more character arrays of labels for that data.

e.g. (pseudocode)

.mat(1,1,1) = datetime arrays; 
.mat(1,1,2) = data corresponding to datetime arrays; 
.mat(1,1,3) = labels for each column in that data. 

Obviously I need to load this into Python with loadmat('.mat') and then I get confused because my variable explorer does not show the .mat file. I have no idea how to pick apart the contents to correctly convert datettime indices accordingly, numbers to floats, etc.

Any guidance would be appreciated!

Right now I simply have:

filemat = 'Pdata.mat'
Pdata = sio.loadmat(filemat)

It is loading the .mat as an object from what I can tell.

2 Answers

How about assigning a variable that only contains a ranged value of 'a'? is it possible like this?

x1 = mat['a', range(1, 20, 1)]
Related