How to replace a dataset with different dimensions in an .H5 file - hdf5lib2 error
Afficher commentaires plus anciens
I have a dataset comprising a cube of images, with dimension 256x320x151. I need tu cut it down to a dataset with dimension 256x320x10, while keeping all the other attributes invariate, as they have useful information on the data acquisition parameters.
I have tried the code:
h5disp('PCA_cube - Copia.h5')
fileattrib('PCA_cube - Copia.h5','+w');
fid = H5F.open('PCA_cube - Copia.h5','H5F_ACC_RDWR','H5P_DEFAULT');
dset_id = H5D.open(fid,'/Cube/Images');
H5D.set_extent(dset_id,[320,256,10]); % C-style indexing
H5D.close(dset_id);
H5F.close(fid);
h5read(PCA_cube - Copia.h5', '/Cube/Images')
However I get the error message: "Error using hdf5lib2 : The HDF5 library encountered an error and produced the following stack trace information:H5D__set_extent dataset has contiguous storage"
I'm adding also some information on the file structure:

Any help or suggestion is much welcome!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur HDF5 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!