It is a Dynamic problem. Export seems to be tagged dynamic somewhere. This is workaround. When I saw this, I remembered similar problem few days ago, and I used the same trick given there and it worked.
I set SynchronousUpdating -> False
and ContinuousAction -> False
else it will be very slow since you'll be trying to make a pdf file for each small tick change. Now a PDF file will be created when you release the mouse only from the slider.
SetDirectory[NotebookDirectory[]]; (*so we know where the PDF file is *)
Manipulate[
Module[{x},
pl = Plot[Sin[a x + b], {x, 0, 6}];
myExport["myPlot.pdf", pl];
pl
],
{a, 1, 4},
{b, 0, 10},
SynchronousUpdating -> False,
ContinuousAction -> False,
Initialization :>
(
myExport[type_String, p_] := myExport[type, p] = Export[type, p]
)
]
reference: Manipulate keeps updating due to a function
Update
The problem as I saw it, is why Manipulate continue to update when using an Export
when though Export
is clearly not updating any of the control variables. On V 9.01, these are animations showing the problem. First animation is the original code posted above, and the second one, after adding SynchronousUpdating -> False
.
The real question I assumed why: Why does this happen.
and