I used to do a lot of programming in R and recently switched to MathematicaMathematica. One thing that bothers me is that I haven't found a way to save variables, their values and definition!
Let's look at an example:
idx = Partition[RandomSample[Range[20], 20], 3];
Table[Subscript[vars, idx[[i]]] = Total[idx[[i]]], {i, 1,
Length[idx]}];
Subscript[vars,{9,15,8}]
(*32*)
Is there a way to save the variable names as well as the corresponding values. And how would I read them into a new file? So that in a new file I can access with Subscript[vars,{9,15,8}]
the value.
I tried it with Table[...]>>values.mx
and read it in with values=<<values.mx
but that only gives me the values, whereas I also need the definitions. I also tried it with DumpSave
:
DumpSave["values.mx",
Table[Subscript[vars, idx[[i]]] = Total[idx[[i]]], {i, 1, Length[idx]}]]
but didn't get the syntax right and it didn't work. Help greatly appreciated!got an error
DumpSave::bsnosym: "Table[..] is not defined as a symbol or a context"