# HDF5: Writing to a Compound Table

**URL:** <https://discourse.julialang.org/t/hdf5-writing-to-a-compound-table/6265>\
**Category:** Data\
**Tags:** hdf5, data\
**Created:** [October 5, 2017, 3:46pm UTC](https://discourse.julialang.org/t/hdf5-writing-to-a-compound-table/6265 "2017-10-05T15:46:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeremy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeremy/32/295_2.png) [@Jeremy](https://discourse.julialang.org/u/Jeremy)\
**Post date:** [October 5, 2017, 3:46pm UTC](https://discourse.julialang.org/t/hdf5-writing-to-a-compound-table/6265/1 "2017-10-05T15:46:47Z")

</div>

How do I write data to a compound table in an HDF5 file?

I’ve figured out how to create the table.

```julia
src = "/home/user/Desktop/hdf5_test.h5"

h5open(src, "w") do file
	cols = ["foo","bar","blah","blahblahblah"]
	memtype_id = HDF5.h5t_create(HDF5.H5T_COMPOUND, length(cols)*sizeof(Float64))
	for i=1:1:length(cols)
		HDF5.h5t_insert(memtype_id,cols[i], (i-1)*sizeof(Float64), HDF5.hdf5_type_id(Float64))
	end
	dt = HDF5Datatype(memtype_id)
	#ds = dataspace((20,))
	ds = dataspace((-1))
	d = d_create(file, "CompoundTable", dt, ds)
end

```

Going through the source in the HDF5 package and the HDF5 Group documentation has helped me get this far but now I’m stuck.
