Hello,
I am currently running some simulations and would like to serialize some parameters for the model.
Using symbols I thought I could get away with a concise way of writing it :
c, d = 1, 2
serialize(open("save1.sl","w"),Dict(string(x)=>eval(x) for x=[:c,:d]))
But ran into an unexpected behaviour when running the same code inside a function
using Serialization
function test()
a ,b = 1
serialize(open("save2.sl","w"),Dict(string(x)=>eval(x) for x=[:a,:b])) # ERROR: LoadError: UndefVarError: a not defined
end
test() # fails a is undefined
This seems like a trivial issue but I couldn’t find any help within the documentation…
Thanks in advance for your help!