I have a .mat dataset obtained from Matlab that have some data, including an 1920x1 Cell Array String stored as follow:
"sample1"
"sample2"
"sample3"
I need to import it in Python as list or array. I already got my mat using loadmat from scipy and works fine importing other type of data, but I'm facing issues trying to import cell string array:
import scipy.io as spio
import pandas as pd
import numpy as np
mat = spio.loadmat('Dati.mat', squeeze_me=True)
FD_Labels_cell = mat_char['FD_Labels']
list= np.asarray(FD_Labels_cell, dtype=object).tolist()
print(list)
output:
[[MatlabOpaque([(b'', b'MCOS', b'string', array([[3707764736],
[ 2],
[ 1],
[ 1],
[ 1],
[ 1]], dtype=uint32))],
dtype=[('s0', 'O'), ('s1', 'O'), ('s2', 'O'), ('arr', 'O')])], [MatlabOpaque([(b'', b'MCOS', b'string', array([[3707764736],
[ 2],
[ 1],
[ 1],
[ 2],
[ 1]], dtype=uint32))],
dtype=[('s0', 'O'), ('s1', 'O'), ('s2', 'O'), ('arr', 'O')])], [MatlabOpaque([(b'', b'MCOS', b'string', array([[3707764736],
[ 2],
[ 1],
[ 1],
[ 3],
[ 1]], dtype=uint32))],
dtype=[('s0', 'O'), ('s1', 'O'), ('s2', 'O'), ('arr', 'O')])], [MatlabOpaque([(b'', b'MCOS', b'string', array([[3707764736]
and output goes on. I don't know why I get this kind of output and I'm unable to get cells from my Matlab file.
MatlabOpaquemeans the cell contains MATLAB objects thatloadmatcan't convert to python equivalents.table, then write it to a csv (writetable)?