IGORWaveUnits in HDF5 files

I intend to use IGORWaveUnits attributes to pass units information to IGOR when I write the file in Matlab:
hdf5write('C:\Temp\test.h5','/Matrix',rand(200)); attrd.Name='IGORWaveUnits'; attrd.AttachType='dataset'; attrd.AttachedTo='/Matrix'; attr = {'','deg','eV'}; hdf5write('C:\Temp\test.h5',attrd, attr,'WriteMode','append');
When viewing in IGOR HDF5 browser, it looks fine. It gives error when load: HDF5 library error while reading wave units as attribute (HDF5 Library Error -1)
variable fid;
HDF5OpenFile /R  fid as "C:\\Temp\\test.h5"
HDF5LoadData/IGOR=-1 fid,"/Matrix"


It seems the IGORWaveUnits attribute type that IGOR looks for is different with the one written in Matlab. If I use IGOR to export an HDF5 file and check this attribute in Malab, it is the same as the one written in Matlab, i.e. hdf5.h5string 3-by-1.

Does anyone try to transfer in HDF5 format between IGOR and other programs?
Thanks.
The HDF5 file is attached.
test.zip (294.62 KB)
I found out with the help of Python that IGOR uses variable-length string type to store IGORWaveUnits. The following python code writes correctly IGORWaeUnits that IGOR understands:
import h5py import numpy f = h5py.File(r'C:\Temp\py.h5','w') ds = f.create_dataset('/Matrix',(200,200)) dt = h5py.special_dtype(vlen=str) ds.attrs['IGORWaveUnits'] = numpy.array(['', 'angle', 'eV'], dtype=dt) f.close()
Now I would need to find out how to create variable-length string in Matlab.
The help for HDF5LoadData /IGOR refers you to HDF5SaveData /IGOR. This says:

Quote:
Bit 2: Write wave units attribute named "IGORWaveUnits". This attribute is written using a variable-length, null-terminated string datatype.


So you are correct - you need to write a variable-length null-terminated string.