Matlab reads h5 file generated with pandas

I have a csv file and I converted it to an h5 file using pandas:

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

      

Now I would like to read it using Matlab.

How can i do this?

I 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');

      

+3


source to share


1 answer


You need to export with format='table'

, see the docs here .



This can be read by various packages R

and should be fine in matlab as it is simple vanilla HDF5

that is tied to some metadata (which is probably not automatically read).

+1


source







All Articles