Shreyas Kamath
Shreyas Kamath

Reputation: 425

De-referening an hdf5 format?

I am working with two different languages i.e. Matlab and python. I created 5 variables in Matlab. Each variable has a size- (150x1) cells as shown below:

enter image description here

Each cell has a size of (128 x (:)) as shown below:

enter image description here

I saved this workspace into a .mat file using -v7.3 which is a hdf5 format.

In python, I loaded the .mat file using h5py. I was able to load the variables but I am unable to extract the values from each variable.

I get this statement "array([[], dtype=object)" but the values are not loaded into the python workspace. I would like to load all the 150 cells o into a variable say A. How do I de-reference the hdf5 reference?

Upvotes: 1

Views: 228

Answers (2)

ndou
ndou

Reputation: 1178

To de-reference, use:

f[ref]

where f is the h5py.File object and ref is the <HDF5 object reference> object.

See the h5py documentation on references

Upvotes: 0

pablo_worker
pablo_worker

Reputation: 1122

Maybe you should save the data in a regular hdf5 file. The .mat file is based on hdf5, but it is not a plain hdf5 file.

In MATLAB you can do it natively using http://es.mathworks.com/help/matlab/import_export/exporting-to-hierarchical-data-format-hdf5-files.html

Upvotes: 3

Related Questions