Hello all -

I have scoured the internet and cannot find any example code for what
I am trying to do.

Using  matlab, I am trying to insert a variable length integer array
(2 x 1) into a compound data type.  I can insert a compound datatype
and I can insert variable length strings.  Here is my code:

data.temp1 = uint32([7; 0]);
data.temp2 = int32([0; 0]);

intType1=H5T.copy('H5T_NATIVE_UINT');
sz(1)     =H5T.get_size(intType1);
intType2=H5T.copy('H5T_STD_U32LE');
varType1   =H5T.vlen_create(intType1);
sz(2)     =H5T.get_size(varType1);
sz(3)     =H5T.get_size(intType2);

offset(1)=0;
offset(2:3)=cumsum(sz(1:2));
sz(3) = 0;

%
% Create the compound datatype for memory.
%

memtype = H5T.create ('H5T_COMPOUND', sum(sz));
varType1   =H5T.vlen_create(intType1);
varType2   =H5T.vlen_create(intType2);


H5T.insert (memtype,...
   'resolution',offset(1),intType1);
H5T.insert (memtype,...
   'badValues',offset(2), varType1);

filetype = H5T.create ('H5T_COMPOUND', sum(sz));
H5T.insert (filetype, 'Temp1', offset(1),intType2);
H5T.insert (filetype, 'Temp2, offset(2),varType2);


space = H5S.create_simple (1,fliplr(2), []);
%
% Create the dataset and write the compound data to it.
%
dset = H5D.create (BandStats, BandStatData{1}, memtype, space, 'H5P_DEFAULT');
H5D.write (dset, filetype, 'H5S_ALL', 'H5S_ALL', 'H5P_DEFAULT', data);

The code runs, but MatLab crashes after the write command.

Any help would GREATLY be appreciated.

Thank you.
Ben

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to