I created a simple routine that cleans up and reorganizes a fairly big data array. The routine is wrapped in Module. It takes about 15 seconds to run, and it works fine. But when I then place the module inside Manipulate, where there is only one control that is used to select the kind of information displayed about the array, the routine aborts in 15 to 20 seconds (spinning beach ball on Mac and $Abort returned in Manipulate). Is there something new in version 10 that would cause this? TimeConstrained? MemoryConstrained? Any tips would be most appreciated.
The likely reason is that the computation is taking so long. Manipulate (and various other dynamic things in Mathematica such as Buttons) is set up to time out after a system-specified number of seconds (5 seconds for Manipulate). The main design reason for this is that things that are expected to respond quickly should, as a general rule, not take a long time to respond. Read the documentation on the SynchronousUpdating option to Manipulate to get a sense of this for Manipulate. And therefor try setting
SynchronousUpdating->False
in your Manipulate to see if that makes a difference in the behavior. Let me know what happens..>!
Thanks, David. Works like a charm! Is there some way I can have a message, such as “Computation in progress…”, display in the content area while the script is running?
Manipulate[
Module[{nb},
nb = CreateDialog[{TextCell["Computing..."],
TextCell[
ProgressIndicator[Dynamic[Clock[Infinity]], Indeterminate]],
TextCell["Click OK to close"], DefaultButton[]}];
Pause[3];
NotebookClose[nb];
u],
{u, 0, 1},
ContinuousAction -> False,
SynchronousUpdating -> False]
Note the ContinuousAction → False option setting that serves to keep the computation from starting until you let go of the mouse button after moving the slider to the desired position.
Excellent. Thanks again, David. It even works without the close button, leaving only the progress bar. I’m going to try to tweak it a little, so that the dialog window remains the front window while the Manipulate is computing.