필터 지우기
필터 지우기

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

조회 수: 9 (최근 30일)
Sunson29
Sunson29 2019년 4월 15일
댓글: Sunson29 2019년 4월 18일
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
Pavel Inchin
Pavel Inchin 2019년 4월 15일
편집: Pavel Inchin 2019년 4월 15일
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 2019년 4월 18일
thank you!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 HDF5에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by