Donbeo
Donbeo

Reputation: 17647

matlab read h5 file produced with pandas

I have a csv file and I have transformed it in an h5 file with pandas:

data = pd.read_csv('file.csv')
data.to_hdf('file.h5', 'table')

Now I would like to read it with matlab.

How can I do that?

I have tried

data = h5read('file.h5','/g4/lat');

but I get:

Error using h5readc
The HDF5 library encountered an error and produced the
following stack trace information:

    H5G_traverse_real    component not found
    H5G_traverse         internal path traversal failed
    H5G_loc_find         can't find object
    H5Dopen2             not found

Error in h5read (line 58)
[data,var_class] =
h5readc(Filename,Dataset,start,count,stride);

Error in read_time_series (line 4)
data = h5read(data_path,'/g4/lat');

Upvotes: 3

Views: 1875

Answers (1)

Jeff
Jeff

Reputation: 129068

You need to export with format='table', see docs here.

This is can be read by various R packages and should be ok in matlab, as this is plain vanilla HDF5, which some meta-data attached (which is probably not read automatically).

Upvotes: 1

Related Questions