import data from a matlab structure and store it in matrices in python

39 Views Asked by At

I have some data stored in a 1x1 with 8 fields struct in matlab. I want to store the data of each field (which is a table) in a matrix in Python

I tried this:

import scipy.io
import numpy as np

# Load the .mat file
data = scipy.io.loadmat('file.mat')

# Access the struct within the loaded data
my_struct = data['structkey']

# Convert each table to a matrix
table1_matrix = my_struct['table1'][0, 0]['arr']
print(table1_matrix)

but this is what I got:

[array([[3707764736],
[         2],
[         1],
[         1],
[         1],
[         1]], dtype=uint32)]

each table is 15200*51 and I need the data stored in it but I have no idea how to access it

0

There are 0 best solutions below