I am trying to save data as HDF5 datasets and keep encountering this long error message when attempting to using h5write:
Warning: The following error was caught while executing 'H5ML.id' class destructor:
Error using hdf5lib2
The HDF5 library encountered an error and produced the following stack trace information:
H5FD_sec2_truncate unable to extend file properly
H5FD_truncate driver truncate request failed
H5F_dest low level truncate failed
H5F_try_close problems closing file
H5O_close problem attempting file close
H5D_close unable to release object header
H5I_dec_app_ref can't decrement ID ref count
H5I_dec_app_ref_always_close can't decrement ID ref count
H5Dclose can't decrement count on dataset ID
Error in H5ML.id/close (line 47)
H5ML.hdf5lib2(obj.callback, obj.identifier);
Error in H5ML.id/delete (line 36)
obj.close();
Error in h5write (line 46)
if nargin > 0
Error in HDFDataBase (line 28)
h5write('myh5file.h5',[dsname '_AR'],ar)
> In h5write (line 46)
In HDFDataBase (line 28)
I have no idea what I am doing wrong as it seems to work for some datasets, but not for others. This is what I am attempting to run:
path = 'D:\Exp1\group1\test1\';
d = dir([path '*.mat']);
for ii = 1:numel(d)
dsname = ['/Exp1/group1/test1/' d(ii).name(1:end-4)];
h5create('myh5file.h5',[dsname '_AR'],[200 43200])
h5create('myh5file.h5',[dsname '_RAW'],[800 43200])
h5create('myh5file.h5',[dsname '_ACCVAR'],[1 43200])
data = load([path d(ii).name]);
ar = [];
eeg = [];
acc = [];
for jj = 1:numel(data)
ar = horzcat(ar,data(jj).ARDATA);
raw = horzcat(raw,data(jj).RAWDATA);
acc = horzcat(acc,data(jj).ACCVAR);
end
h5write('myh5file.h5',[dsname '_AR'],ar)
h5write('myh5file.h5',[dsname '_EEG'],raw)
h5write('myh5file.h5',[dsname '_ACCVAR'],acc)
end
Any help would be greatly appreciated, thanks