Tôi có một cấu trúc mảng được tạo ra bởi matlab và lưu trữ trong định dạng v7.3 mat file:Cách đọc tệp mat v7.3 qua h5py?
struArray = struct('name', {'one', 'two', 'three'},
'id', {1,2,3},
'data', {[1:10], [3:9], [0]})
save('test.mat', 'struArray', '-v7.3')
Bây giờ tôi muốn đọc tập tin này qua python sử dụng h5py:
data = h5py.File('test.mat')
struArray = data['/struArray']
Tôi không có ý tưởng làm thế nào để có được một trong những dữ liệu struct bằng một từ struArray
:
for index in range(<the size of struArray>):
elem = <the index th struct in struArray>
name = <the name of elem>
id = <the id of elem>
data = <the data of elem>
Bạn đã tìm thấy một giải pháp thực tế cho việc này? – Pastafarian
Tôi có một câu hỏi tương tự, với một giải pháp từng phần: http://stackoverflow.com/questions/29852481/reading-all-variables-in-a-mat-file-with-python-h5py/29856030#29856030 – CodyF