Re: Obtaining the output from the line above.
- To: mathgroup at smc.vnet.net
- Subject: [mg59384] Re: Obtaining the output from the line above.
- From: ggroup at sarj.ca
- Date: Sun, 7 Aug 2005 03:47:37 -0400 (EDT)
- References: <dcpkfe$6dj$1@smc.vnet.net><dd1im9$1cf$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
PJW wrote: > This may not be exactly what you are looking for Joe but it is a start. Very nice. A simple modification (ToExpression) and wrapping the lines into a function makes it possible to use the result in the next calculation. This one is a strong contender for inclusion into my default notebook...Thanks! In[2]:= LastCell[] := Block[{lastcell}, CurrentNotebook = EvaluationNotebook[]; SelectionMove[CurrentNotebook, Cell, EvaluationCell]; SelectionMove[CurrentNotebook, Previous, CellContents]; lastcell = ToExpression[NotebookRead[CurrentNotebook]]; SelectionMove[CurrentNotebook, After, EvaluationCell]; lastcell] Example: In[3]:= Log[Exp[4]] Out[3]:= 4 In[4]:= 5 * LastCell[] Out[4]:= 20