The class of input data must be integer instead of int32 when the HDF5 class is H5T_STD_U64LE - not sure why?

16 visualizzazioni (ultimi 30 giorni)
Hey all,
I have the following code:
SnirfSave([savename_snirf '.snirf'], snirf_data)
Which gives me the following error:
____________________
SnirfSave([savename_snirf '.snirf'], snirf_data);
Error using hdf5lib2
The class of input data must be integer instead of int32 when the HDF5 class is H5T_STD_U64LE.
Error in H5D.write (line 100)
H5ML.hdf5lib2('H5Dwrite', varargin{:});
Error in hdf5write_safe>write_integer (line 101)
H5D.write(dsid, tid, 'H5S_ALL', 'H5S_ALL', 'H5P_DEFAULT', int32(val));
Error in hdf5write_safe (line 52)
write_integer(fid, name, val);
Error in MeasListClass/SaveHdf5 (line 171)
hdf5write_safe(fid, [location, '/sourceIndex'], uint64(obj.sourceIndex));
Error in DataClass/SaveHdf5 (line 248)
obj.measurementList(ii).SaveHdf5(fid, [location, '/measurementList', num2str(ii)]);
Error in SnirfClass/SaveData (line 672)
obj.data(ii).SaveHdf5(fileobj, [obj.location, '/data', num2str(ii)]);
Error in SnirfClass/SaveHdf5 (line 742)
obj.SaveData(obj.fid);
Error in FileLoadSaveClass/Save (line 78)
obj.SaveHdf5(filename, params);
Error in SnirfSave (line 11)
snirf.Save( filenm )
______________________
I am not sure why this is. I have tried changing the format of the data in 'snirf_data' but this hasn't seemed to resolve the issue.
snirf_data =
SnirfClass with properties:
formatVersion: '1.0'
metaDataTags: [1×1 MetaDataTagsClass]
data: [1×1 DataClass]
stim: [1×4 StimClass]
probe: [1×1 ProbeClass]
aux: [1×52 AuxClass]
bids: [1×1 struct]
snirf_data.data
ans =
DataClass with properties:
dataTimeSeries: [40635×294 double]
time: [40635×1 double]
measurementList: [1×294 MeasListClass]
cache: [1×1 struct]
diagnostic: 0

Risposte (2)

Vatsal
Vatsal il 5 Ott 2023
Hi Emre,
I understand that you are encountering an error while attempting to save the data. The error message indicates there is mismatch between the data type of your input data and the expected data type for the HDF5 class.
From the error message it seems the issue is related to saving the ‘sourceIndex’ property of the ‘MeasListClass. To resolve this issue, you can try explicitly converting the ‘sourceIndex’ property to ‘uint64’ before saving it to the HDF5 file. You can achieve this by using the 'uint64' function for the conversion.
I hope this helps!

theresa Demmer
theresa Demmer il 20 Dic 2023
If you are working with a Mac the issue might also be an HDF5 datatype change after an update. Here is the problem explained with a provided solution:

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by