Python-created HDF5 dataset transposed in Matlab

前端 未结 3 457
情歌与酒
情歌与酒 2020-12-20 16:04

I have some data that I share between Python and Matlab. I used to do it by saving NumPy arrays in MATLAB-style .mat files but would like to switch to HDF5 datasets. However

3条回答
  •  一生所求
    2020-12-20 16:08

    This is a quirk in Matlab's HDF5 reader routines. (I think the reasoning behind this behavior is: the data is in C-order in the binary file, and Matlab arrays are in Fortran order, so they should report the data as transposed rather than go reordering it.)

    If you inspect the file created by Python with HDF5 tools, the dimensions are what they should be:

    $ h5ls test.h5 
    mydataset                Dataset {10, 30}
    

提交回复
热议问题