Re: Best way to save data in notebooks
- To: mathgroup at smc.vnet.net
- Subject: [mg81966] Re: Best way to save data in notebooks
- From: AES <siegman at stanford.edu>
- Date: Sun, 7 Oct 2007 23:59:39 -0400 (EDT)
- Organization: Stanford University
- References: <fea47j$i20$1@smc.vnet.net>
In article <fea47j$i20$1 at smc.vnet.net>, John Fultz <jfultz at wolfram.com> wrote: > > I'd like to have "data" saved in the notebook, so that when I open it, > > I can replot the data. My current solution is to copy and paste the > > data manually into a separate mathematica cell (ie, data={1,2,3...}), > > but that causes the front-end to freeze when largedatafile.csv is too > > large. > > > > Yaroslav > > Assuming you're using version 6, you could get a compressed form by doing... > > Compress[data] > > ...then modify the output cell by putting the caret at the beginning and > typing > > data=Uncompress@ > > which will convert the Output cell into an Input cell you can evaluate in the > future. It's not quite as fast and convenient as DumpSave, of course, but if > you really insist on keeping the data in the notebook, it'll work. John, Thanks very much. This is one of those very useful tricks that might be difficult for an ordinary user to develop by himself, but can be understood and used once you've seen it. As an extension to it: Suppose the data in question is not necessarily a Plot, maybe just a List; said List is the Output cell created by executing an Input cell; and each time one executes said Input cell one wants to save the new result **and not erase any of the old ones** that may still be sitting there -- except of course one doesn't want to go too far in doing this if the List is large, and one will want to delete selected older Saved Lists from time to time. I think I can actually figure out a procedure that can do this task by myself (maybe add a random name or date to the List name each time you Save one?). But of course if someone more skilled than me wanted to lay out a template for doing this, I'd be delighted to use it instead.