Adding a -v7.3 flag to a large structure array

11 vues (au cours des 30 derniers jours)
Claire Marie Barnes
Claire Marie Barnes le 26 Juil 2019
Hi all,
I have been sent a large structure array as a .mat file. I am attempting to load it into Python and have been advised that should be saved with a -v7.3 flag so that it can be done successfully. I have used
save('newversion.mat','variable','-v7.3')
to do this however, I can't access parts of the array when I import into python and so I was wondering if I have done it correctly.
Many thanks for any help
  5 commentaires
per isakson
per isakson le 26 Juil 2019
Claire Marie Barnes
Claire Marie Barnes le 26 Juil 2019
Yes, there is a module 'h5py' in python which will enable you to import the files

Connectez-vous pour commenter.

Réponses (1)

Sai Sri Pathuri
Sai Sri Pathuri le 8 Août 2019
When you use save function with version 7.3, the data will be compressed by default, which may be the reason why you are unable to access parts of the array when imported into python. Use -nocompression flag in your function.
You may use the following syntax to resolve the issue
save(filename,variables,version,'-nocompression')
Refer the documentation of save from below link

Catégories

En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by