How to add 'ChunkSize' in .h5 file?
조회 수: 17 (최근 30일)
이전 댓글 표시
I would like to resize my dataset (as shown in the attached picture) from 2x20 to 2x3. To achieve this it is necessary to have the ChunkSize to be 2x3. I have been trying to fix this for hours now without any luck. This what I have done so far...
% Ok!, Now let's set the writable attribute of FileName
fileattrib(FileName,'+w');
fid = H5F.open(FileName,'H5F_ACC_RDWR','H5P_DEFAULT');
dset_id = H5D.open(fid,DatasetName);
dcpl = H5D.get_create_plist(dset_id);
chunk_dims = [2 3];
% set it to use the chunked dataset
h5_chunk_dims = fliplr(chunk_dims);
H5P.set_chunk(dcpl,h5_chunk_dims)
% Change size of dataset
H5D.set_extent(dset_id,[3,2]) %[THIS DOES NOT WORK and throw the messag]
=================================
Error using hdf5lib2
The HDF5 library encountered an error and produced the following stack trace information:
H5D__set_extent dataset has contiguous storage
H5Dset_extent unable to set extend dataset
Error in H5D.set_extent (line 27)
H5ML.hdf5lib2('H5Dset_extent', dset_id, h5_extents);
댓글 수: 0
답변 (1개)
Manas Meena
2020년 9월 30일
The error might be because the library cannot find the file/variable that was passed in the “H5P.set_extent” command.
Refer to the below documentation links on how to use the “H5P.set_chunk” and “H5P.set_extent” commands:
You can also refer to the following link to see how to replace a dataset with a smaller dataset in a HDF5 file:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 HDF5에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!