I have a .h5 file of size 128x128x64, hdf5read or h5read command is reading 64x128x128, I want MATLAB to read original size of the file, can you please help me?

8 views (last 30 days)
data = h5read( 'Soln_700.00279.h5','/T')
or
file = hdf5info('Soln_700.00279.h5')
data_P = hdf5read(file.GroupHierarchy.Datasets(1))
I have tried above both commands, but MATLAB is reading the size in reverse I guess, but I do not know which column is x and y, except z that I know is of size 64. I would appreciate any help.
Thank you

Answers (1)

Walter Roberson
Walter Roberson on 26 Jul 2022
You need to examine the hdf5info that is returned, looking at the dimensions information for file.GroupHierarchy.Datasets(1) to try to figure out which is x and which is y.
The most common arrangement in hdf5 files is x, y, z -- which is not the same as what MATLAB uses. MATLAB uses y, x, z so it is common to see something like
data_P = permute(data_P, [2 1 3]);
  1 Comment
Vinay Tripathi
Vinay Tripathi on 26 Jul 2022
Hi, thank you for responding.
But here, I have 64 grids in z direction that is how I know 64 dimension is in z direction. but x and y I don't understand, given same number of grids in both the directions. Matlab is showing either z, x, y or z, y, x, that I still need help with!
here is the hdf5 info -
info =
struct with fields:
Filename: '\Soln_700.00279.h5'
Name: '/'
Groups: []
Datasets: [8×1 struct]
Datatypes: []
Links: []
Attributes: []
HDF5 Soln_700.00279.h5
Group '/'
Dataset 'P'
Size: 64x128x128
MaxSize: 64x128x128
Datatype: H5T_IEEE_F64LE (double)
ChunkSize: []
Filters: none
FillValue: 0.000000
Dataset 'T'
Size: 64x128x128
MaxSize: 64x128x128
Datatype: H5T_IEEE_F64LE (double)
ChunkSize: []
Filters: none
FillValue: 0.000000
Dataset 'Vx'
Size: 64x128x128
MaxSize: 64x128x128
Datatype: H5T_IEEE_F64LE (double)
ChunkSize: []
Filters: none
FillValue: 0.000000
Dataset 'Vy'
Size: 64x128x128
MaxSize: 64x128x128
Datatype: H5T_IEEE_F64LE (double)
ChunkSize: []
Filters: none
FillValue: 0.000000
Dataset 'Vz'
Size: 64x128x128
MaxSize: 64x128x128
Datatype: H5T_IEEE_F64LE (double)
ChunkSize: []
Filters: none
FillValue: 0.000000
Dataset 'X'
Size: 128
MaxSize: 128
Datatype: H5T_IEEE_F64LE (double)
ChunkSize: []
Filters: none
FillValue: 0.000000
Dataset 'Y'
Size: 128
MaxSize: 128
Datatype: H5T_IEEE_F64LE (double)
ChunkSize: []
Filters: none
FillValue: 0.000000
Dataset 'Z'
Size: 64
MaxSize: 64
Datatype: H5T_IEEE_F64LE (double)
ChunkSize: []
Filters: none
FillValue: 0.000000

Sign in to comment.

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!