Reputation: 550
Im very new to Julia and was trying to save my session (all the values, including functions for example) and didnt see any easy way. There seems to be a pretty complete low level write function for ints, floats, arrays, etc. But it doesnt, for example, write a DataFrames. Is there an easy way to do this or do I need to code all this from scratch? Im using V0.2.1.
Upvotes: 5
Views: 2670
Reputation: 1
I think it can be in Julia Data format (JLD). https://github.com/JuliaIO/JLD.jl
If you have own data fromat e.g. type model
type Model
version::String
id::String
equations::Vector{Equation}
coefs::Vector{Matrix}
end
You can save it with command
using JLD
save("MODEL.jld", "modelS", model1)
and read as
pathReport = joinpath(homedir(),".julia/v0.5/foo/test")
m = JLD.load(joinpath(pathReport, "MODEL.jld"))
model2 = m["modelS"]
model2.equations[1].terms[2] == "EX_01"
Upvotes: 0
Reputation: 91
Checkout out the Julia Data Format https://github.com/JuliaIO/JLD.jl
It can both save specific julia types as well as types you created yourself, and has macros to save your entire workspace at once.
Upvotes: 0
Reputation: 1406
You can do this with HDF5.jl. I don't know how well it works for functions, but it should work fine for data frames and any other native Julia type.
For functions you want to keep, I would probably just define them in a regular .jl
file and include("def.jl")
at the start of the session, for example.
Upvotes: 1
Reputation: 577
Have you tried using the iJulia notebook? This might be useful for what you're describing. https://github.com/JuliaLang/IJulia.jl
Upvotes: 3