How to read only one potion of HDF5 files in Matlab ?

12 visualizaciones (últimos 30 días)
Sunson29
Sunson29 el 15 de Abr. de 2019
Comentada: Sunson29 el 18 de Abr. de 2019
Dear friend,
I am trying to open a very big (20G) hdf5 file in matlab. But the file is too big, so I hope there is a way I can open just samll part of the matrix. For example, the matric is 2x1024x2555904, I wish to only read or access part of the matrix. it could be just 2x1024x(1:100) something like that.
If I do h5disp('GOLD_XYZ_OSC.0001_1024.hdf5')
HDF5 GOLD_XYZ_OSC.0001_1024.hdf5
Group '/'
Dataset 'X'
Size: 2x1024x2555904
MaxSize: 2x1024x2555904
Datatype: H5T_IEEE_F32LE (single)
ChunkSize: []
Filters: none
FillValue: 0.000000
Dataset 'Y'
Size: 24x2555904
MaxSize: 24x2555904
Datatype: H5T_STD_I64LE (int64)
ChunkSize: []
Filters: none
FillValue: 0
Dataset 'Z'
Size: 1x2555904
MaxSize: 1x2555904
Datatype: H5T_STD_I64LE (int64)
ChunkSize: []
Filters: none
FillValue: 0
I do can access Y or Z, because they are small. e.g dset = hdf5read('GOLD_XYZ_OSC.0001_1024.hdf5','/Z');
X here is the 20G data, so,Matlab cannot let me do that, because is says its too big. Is there a way I can just access or read part of data ? E.g, just show 3rd dim from 1:100, so output size is 2x1024x100 in X ?
Btw, I tried dset2 = h5read('GOLD_XYZ_OSC.0001_1024.hdf5','/X',[2 2 1],[2 2 10]); I got error: The index arguments exceed the size of the dataset. Why, it is in the range, right?
If yes, someone can teach me the code to do that? Thank you!
update: the new question is, how to take a chuck of X but not from very beginning? For example, I want the check dset3 = X(:,:,101:200) ? All value in 1st dim, all value in 2nd dim, but 3rd dim is from 101 to 200. Thanks.
  4 comentarios
Pavel Inchin
Pavel Inchin el 15 de Abr. de 2019
Editada: Pavel Inchin el 15 de Abr. de 2019
yes, you are right. As I wrote earlier, in second brackets you have to set number of elements you want to get startring from 101 (in your case), so yes [1 1 101] [2 1024 100] will give you [1:2,1:1024,101:200]
Sunson29
Sunson29 el 18 de Abr. de 2019
thank you!

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by