Import struct with different data type to python dataframe
古いコメントを表示
Hi,
I tried using python to load the data stored in a matlab struct - the struct i in a file attached.
Here is what I tried:
import scipy.io
import pandas as pd
mat = scipy.io.loadmat("file.mat")
data = mat["struct"]
Then, when I look to what is inside of 'data' I have this:
array([[(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'datetime', array([[3707764736],
[ 2],
[ 1],
[ 1],
[ 2],
[ 2]], dtype=uint32)) ],
dtype=[('s0', 'O'), ('s1', 'O'), ('s2', 'O'), ('arr', 'O')]), MatlabOpaque([(b'', b'MCOS', b'duration', array([[3707764736],
[ 2],
[ 1],
[ 1],
[ 3],
[ 3]], dtype=uint32)) ],
dtype=[('s0', 'O'), ('s1', 'O'), ('s2', 'O'), ('arr', 'O')]), array([[1.0082, 1.0102, 1.01 ]])) ]],
dtype=[('Name', 'O'), ('init', 'O'), ('age', 'O'), ('measure', 'O')])
Hoy can I get the data stored in the mat file then?
Thanks in advance for your help.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Call MATLAB from Python についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!