1
$\begingroup$

I have some complicated Manipulate[] object that I'd like to make interactively available online. The function CloudDeploy[] seems up for the task, but when I use it I get an online object that does not respond. The sliders and all work fine, but the thing inside just does not update.

The following example reproduces this behavior:

f[x_] := x^2
Manipulate[
 Plot[a f[x], {x, -10, 10}, PlotRange -> {0, 100}],
 {a, 0, 1}]

I get the same behavior regardless of whether I do CloudDeploy[] on the Manipulate[] object only, or on the entire thing. My guess is that it does not work because it's not a single expression, so the solution would be to massage all my functions into the Manipulate[] expression, but that will be arduous to say the least, so I was wondering if there are better ways to go about this.

$\endgroup$
0

1 Answer 1

3
$\begingroup$

You must use the SaveDefinitions option on 'Manipulate' which you should save as a separate variable, i.e.:

m = Manipulate[
 Plot[a f[x], {x, -10, 10}, PlotRange -> {0, 100}], 
 {a, 0, 1}, 
 SaveDefinitions -> True]

CloudDeploy[m, Permissions -> "Public"]

This will automatically store the definitions of any symbols used by the Manipulate into it.

Hope this helps.

$\endgroup$
1
  • $\begingroup$ What a great tip, thanks! I only found that when I now put the Manipulate[] inside of a CloudDeploy[] the problem persists. However, when I save the Manipulate[] to a variable and do CloudDeploy[] on that it all works out. I hope you don't mind me changing your answer to reflect that. $\endgroup$
    – Julius
    Commented Jun 2, 2019 at 17:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.