I want to send a few Manipulate Plots and regular plots to my advisor in a notebook. I typically Import data into my notebook to generate plots but when I open my file on a new computer, the regular Plots stay but the Manipulate ones are dead, until I Import the data again. Is there any way I can keep the data inside the notebook so when he "enables dynamic" to open the notebook on his computer, that the Manipulate plots become active, just the way the data in regular plots are not lost ?
Answer
SaveDefinitions would work for you I guess.
Try the below code. Execute, then save the notebook it is in. Kill the kernel with Quit[] and reopen the notebook. Content is still there and is manipulable without re-executing.
f = ExampleData[{"Text", "GettysburgAddress"}];
Manipulate[
ListPlot[(StringLength /@ StringSplit[f])[[;; ;; i]]],
{i, 1, 5, 1},
SaveDefinitions -> True
]

Comments
Post a Comment