New subject: Read HDF5 file with string with variable length in C#

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

New subject: Read HDF5 file with string with variable length in C#




Using C#, I can easily read an array of a native type as shown below but I need to read also an array of variable string, how can I do ?


using HDF5DotNet;



var fileId =, H5F.OpenMode.ACC_RDONLY);

var resultUShort = Read2DArray<ushort>(fileId, "Data");



public T[,] Read2DArray<T>(H5FileId fileId, string dataSetName)


    var dataset =, dataSetName);

    var space = H5D.getSpace(dataset);

    var dims = H5S.getSimpleExtentDims(space);

    var dataType = H5D.getType(dataset);


    var dataArray = new T[dims[0], dims[1]];

    var wrapArray = new H5Array<T>(dataArray);, dataType, wrapArray);

    return dataArray;



How can I read an array of variable length in  C# ?


I have a section called : ‘MetaKeys’


Information from HDFView (2.13) :

MetaKeys (1712, 4)

    String, length = variable,    359

    Number of attributes = 1

        long_name = Metadata Keys



Any help will really be appreciate !




This e-mail and any accompanying attachments are confidential. If you are not the intended recipient, you must not review, disclose, copy, distribute or use this e-mail; please delete it from your system and notify the sender immediately.

Hdf-forum is for HDF software users discussion.
[hidden email]