Re: Extracting graphics from notebook
- To: mathgroup at smc.vnet.net
- Subject: [mg115459] Re: Extracting graphics from notebook
- From: John Fultz <jfultz at wolfram.com>
- Date: Tue, 11 Jan 2011 19:21:33 -0500 (EST)
On Tue, 11 Jan 2011 00:35:08 -0500 (EST), Chris Degnen wrote: > Hi, Can anyone suggest how I can address a graphics object from a > saved notebook. In the example below the most I can do is to > CellPrint the object, but I would like to set it to a variable. > > > dir == Directory[]; > > nb1 == CreateDocument[Plot[Sin[x], {x, 0, 2 Pi}], > NotebookFileName -> dir <> "\\" <> "Sin2Pi.nb"]; > > NotebookSave[nb1]; > NotebookClose[nb1]; > > nb2 == NotebookOpen[dir <> "\\" <> "Sin2Pi.nb"]; > > SelectionMove[nb2, Next, Cell] > > CellPrint[NotebookRead[nb2]] > NotebookClose[nb2]; Converting the output of NotebookRead to the equivalent Mathematica expression requires ToExpression. expr == ToExpression[NotebookRead[nb2]]; Or you could do this manually by simply copying the graphic and pasting it into an Input cell. Sincerely, John Fultz jfultz at wolfram.com User Interface Group Wolfram Research, Inc.