# Save Array of Arrays in HDF5

**URL:** https://discourse.julialang.org/t/save-array-of-arrays-in-hdf5/31359
**Category:** General Usage
**Tags:** question, hdf5
**Created:** [November 21, 2019, 9:13pm UTC](https://discourse.julialang.org/t/save-array-of-arrays-in-hdf5/31359 "2019-11-21T21:13:27Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jacob-roth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jacob-roth/32/1862_2.png) [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)
#### Post date: [November 21, 2019, 9:13pm UTC](https://discourse.julialang.org/t/save-array-of-arrays-in-hdf5/31359/1 "2019-11-21T21:13:28Z")

</div>

Continuing the discussion from [here](https://discourse.julialang.org/t/write-structure-to-hdf5-file-and-read-a-compound-type-from-hdf5-into-julia-structure/20358/4) and [here](https://stackoverflow.com/questions/58983994/save-array-of-arrays-hdf5-julia), how can I best save a large number of arrays using HDF5? And more generally, how can I save an array of arrays?

I know that HDF5 doesn’t support array of arrays, so trying the below doesn’t work:

```julia
julia> using HDF5

julia> x = [[1]]
1-element Array{Array{Int64,1},1}:
 [1]

julia> fid = h5open("test.h5", "w")
HDF5 data file: test.h5

julia> g = g_create(fid, "array-of-arrays")
HDF5 group: /array-of-arrays (file: test.h5)

julia> write(g, x)
ERROR: MethodError: no method matching write(::HDF5Group, ::Array{Array{Int64,1},1})

```

In my particular case I have a single array containing 10,000 arrays of varying lengths. I’d like the 10,000 arrays to be part of a “group”, but creating new datasets / groups for each array makes reading the file very slow, so I am seeking an alternative.

Thanks!

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [November 22, 2019, 9:26am UTC](https://discourse.julialang.org/t/save-array-of-arrays-in-hdf5/31359/2 "2019-11-22T09:26:43Z")

</div>

What did you try, and how did it fail? Please provide an MWE.

> [@Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757):
>
> Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer. Keywords are highlighted to make it easier to refer to specific points. Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …
