C# HDF5DotNet writing array of strings to a dataset


#1

Hello,
I’m trying to write an array of strings into a dataset using HDF5DotNet and when I check the file, the dataset contains only “@ëûp” where the strings should be.

I’ve successfully created an hdf5 file and created a dataset of floats that represent biomedical signals. In this dataset that I’m currently trying to create I need to have some info about the signals, which I have now in an array of strings. I’ve checked the array in console- the strings in dset_info are just as I want them. I’ve created a dataspace, a datatype (documentation specifies to put a negative number if I want a variable-length string type), the dataset and I attempted to write the array to the dataset. Here is my code:

//creation of dset_info is before that
H5DataSpaceId spaceIdinfo = H5S.create_simple(RANK, dimsinfo);

H5DataTypeId typeIdinfo = H5T.create(H5T.CreateClass.STRING, -1);

H5DataSetId dataSetIdinfo = H5D.create(fileId, “/Info”, typeIdinfo, spaceIdinfo);

H5D.write(dataSetIdinfo, typeIdinfo , new H5Array(dset_info));

This is only the part where I write the array to the dataset. As I said, I checked dset_info and it’s fine. After opening the file in HDFView I open the dataset, it’s a 2x3 array with this: “@ëûp” instead of strings that I want. What am I doing wrong here?