Re: Saving data with notebook
- To: mathgroup at smc.vnet.net
- Subject: [mg111923] Re: Saving data with notebook
- From: Vince Virgilio <blueschi at gmail.com>
- Date: Thu, 19 Aug 2010 07:20:47 -0400 (EDT)
- References: <i4d68j$6om$1@smc.vnet.net>
On Aug 17, 1:21 am, "Kent A. Vander Velden"
<kent.vandervel... at gmail.com> wrote:
> My routine is typically to Import[] data into Mathematica (often multiple
> files), perform some manipulation, and plot the results. I'd like to be able
> to use the Mathematica notebook as the archive of the raw data, analysis,
> and results. To do this, I'd like to save the contents of some if not all
> the variables associated with a notebook, preferably into the notebook. I've
SNIP
Kent,
Here's something I haven't used for a while, but might provide
inspiration. For large values, it is s l o w.
SetAttributes[saveInNotebook, HoldFirst];
saveInNotebook[var_, value_] :=
With[{c = Compress@value},
CellPrint@
ExpressionCell[Defer[var = Uncompress@c;], "Input", CellOpen ->
False]
];
You might find it difficult to find the closed cell that
saveInNotebook creates. So you might add prefatory text or heading
before evaluating saveInNotebook "in-place".
Vince