IGORWaveUnits in HDF5 files
wang
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"
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.
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.
February 15, 2011 at 07:13 am - Permalink
So you are correct - you need to write a variable-length null-terminated string.
February 15, 2011 at 09:10 am - Permalink