the problem related to this question
What I want to do is to Export
definition of several symbol into a single file. The reason I choose Export
is that Export
supports the GZIP
function.
So here is the example: I have
ff[1, 1] = 1;
ff[1, 2] = 2;
gg[1, 1] = 3;
gg[1, 2] = 4;
if I use Save
, then it is simply
Save["ffgg.m", {ff, gg}]
the content of ffgg.m
file
ff[1, 1] = 1
ff[1, 2] = 2
gg[1, 1] = 3
gg[1, 2] = 4
But if I want to Export
, since the syntax of Export
is Export["file", expr]
. It seems that I can only Export
one expr
each time. I tried the following code:
Export["ffgg2.m", {FullDefinition @ ff, FullDefinition @ gg}];
the content of ffgg2.m
will be
(* Created by Wolfram Mathematica 8.0 : www.wolfram.com *)
{ff[1, 1] = 1
ff[1, 2] = 2, gg[1, 1] = 3
gg[1, 2] = 4}
And if I Import ffgg2.m
back, I only get ff[1,1]
and gg[1,1]
. The other two lost.
So how can I Export
several definitions into a single file at a single time?
PutAppend
section was broken on Symbols withOwnValues
assignments; my attempt to keep these unevaluated was poorly conceived. I believe I have corrected the problem. $\endgroup$ – Mr.Wizard Jul 29 '13 at 8:38