Consider a manipulate function such as:
Manipulate[
per = 12.34;
pdata = Table[Sin[2 \[Pi] x/per], {x, n}] + RandomReal[.1, {n}];
ListPlot[pdata], {n, 100, 200, 10}]
which takes some time to re-evaluate each step of its manipulation. I would like to export each step of the manipulation as an image (rasterized or otherwise) & then create a manipulation that simply scrolls though the images, allowing it to run smoothly and quickly. Is there a way to automate something like this?
(NB The code I am working with takes far longer to re-evaluate each step that the example code above, but it works with much the same idea.)
Answer
You can create the images with
images = Image[
ListPlot[
pdata = Table[Sin[2 \[Pi] x/12.34], {x, #}] +
RandomReal[.1, {#}]]] & /@ Table[i, {i, 100, 200, 10}];
and show them with
Manipulate[images[[n]], {n, 1, Length[images], 1}]
then you can export them with
Export[NotebookDirectory[] <> "image" <> ToString[#] <> ".tif", Image[images[[#]]]] & /@ Range[Length[images]]
later on (i.e. in another notebook residing in the same directory) you simply load the images into a list and view them with
Manipulate[images[[n]], {n, 1, Length[images], 1}]
Comments
Post a Comment