MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: saving data in a new cell

  • To: mathgroup at
  • Subject: [mg55469] Re: saving data in a new cell
  • From: David Bailey <dave at>
  • Date: Fri, 25 Mar 2005 05:48:12 -0500 (EST)
  • References: <d1tvdd$rlp$>
  • Sender: owner-wri-mathgroup at

dkl8 wrote:
> Hello there ,
> I am interested in saving data in a new notebook , in a new cell .
> For example , I have
> a=5;
> b={1,2,3,4,5};
> I can use
> a>>"filename.nb";
> and
> b>>>"filename.nb";
> but this will create a notebook with "a" and "b" in the same cell .
> That is a problem if "a" and "b" are large lists .
> I am interested in saving "a" and "b" in different cells in the same
> notebook one after the other .
> Another question is how to save "a" and "b" in different cells , but
> with the two cells grouped together .
> Thank you , for your help .
> Doron .

Well - you have told me something new! I must say, when I looked at your 
question I thought that there is no way that you can create a notebook 
in the way that you did - because if you look at the structure of a real 
notebook (say with a text editor) you will see that it contains a lot of 
structure. In fact, it would seem that if a .nb file just contains some 
data, Mathematica silently converts it when you load it!

However, that is not a good way to create another notebook. Create a 
notebook using:


After this you can write cells into your new notebook thus:

NotebookWrite[nb, Cell[BoxData[ToBoxes[{1, 2}]], "Output"]]

The cell grouping is normally determined by the style of the cell. If 
you write a cell containing a heading ahead of several data cells, they 
will all end up grouped together. Try unformatting a cell to determine 
its structure for this process.

David Bailey

  • Prev by Date: Re: FindFit & restricting fitting parameter
  • Next by Date: Re: Re: using Mathematica to plot in visual studio
  • Previous by thread: saving data in a new cell
  • Next by thread: Hypergeometric integral looks wrong ?