Marc Gallant
2015-07-30 15:57:23 UTC
Given the following types:
type Bar
x::Float64
y::Int
end
type Foo
x::Vector{Float64}
y::Bar
z::Matrix{Float64}
end
and the following vector:
a = [Foo([1.1, 2.2], Bar(1.1, 4), rand(2, 2)), Foo([1.3, 2.4], Bar(-1.1,
2), rand(2, 2))]
Do you have any suggestions on how would I go about serializing a? I have a
analogous situation where I do a lot of number crunching resulting in
something that resembles a, but has thousands of entries. I'd like to store
a in a file and read it in later. I've looked into the HDF5 package but I'm
having a hard time figuring out a nice way to disassemble my custom types
so they can be written, and then reconstructing them after the data is
retrieved.
I'm using Julia 0.3.10.
Thanks!
type Bar
x::Float64
y::Int
end
type Foo
x::Vector{Float64}
y::Bar
z::Matrix{Float64}
end
and the following vector:
a = [Foo([1.1, 2.2], Bar(1.1, 4), rand(2, 2)), Foo([1.3, 2.4], Bar(-1.1,
2), rand(2, 2))]
Do you have any suggestions on how would I go about serializing a? I have a
analogous situation where I do a lot of number crunching resulting in
something that resembles a, but has thousands of entries. I'd like to store
a in a file and read it in later. I've looked into the HDF5 package but I'm
having a hard time figuring out a nice way to disassemble my custom types
so they can be written, and then reconstructing them after the data is
retrieved.
I'm using Julia 0.3.10.
Thanks!