I'm having trouble when I write on an existing dataset using hdf5dotnet. I'm writing in run time many times, and only the first write works perfectly. the second overwrite first datas. As you can see on the screen, the 4th first values are correct but the 4th last aren't but the space for it is normally created. I forgot to say it but values are double type.
the code I'm using is there, I'm a newbie on this techno if you have an idea I will take it with pleasure! Please give me any advice for writing at the end of my dataset without overwriting.
if (data.Length <= 0)
return;
try {
H5DataSpaceId dataSpaceId = H5D.getSpace(dataSetId);
int rank = H5S.getSimpleExtentNDims(dataSpaceId);
long[] dims = H5S.getSimpleExtentDims(dataSpaceId);
H5D.getCreatePropertyList(dataSetId);
long[] dims_extended = dims[0] is 1 ? new long[] { (dims[0] + data.Length) - 1 } : new long[] { (dims[0] + data.Length) };
H5D.setExtent(dataSetId, dims_extended);
H5S.selectHyperslab(dataSpaceId, H5S.SelectOperator.SET, new long[] { dims[0] }, new long[] { data.Length });
H5S.create_simple(rank, dims_extended);
H5Array < float > hdf_data = new H5Array<float>(data);
H5DataTypeId dataTypeId = H5D.getType(dataSetId);
H5D.write(dataSetId, dataTypeId, hdf_data);
} catch (HDFException e) {
MessageBox.Show(e.Message);
}