1
$\begingroup$

I am trying to CloudDeploy a Manipulate with codes of multiple linesin Programming Lab. Taking a simple sin curve as below. If I simply use CloudDeploy[Manipulate[Plot[Sin[n*x], {x, 0, 6}], {n, 1, 10}]] , there is no problem and I can deploy the manipulate successfully. But I need something more complicated and I starts to split the code into 2 lines as below, and the deploy is a manipulate with button but the curve disappeared. How can I deploy the manipulate? Many thanks!

My current code:-

CloudDeploy[(
f[n_, x_] = Sin[n*x];
Manipulate[Plot[f[n, x], {x, 0, 6}], {n, 1, 10}]
)]
$\endgroup$
  • $\begingroup$ Shortly, add SaveDefinitions as CloudDeploy does not parse Manipulate when collecting dependencies. p.s. let me know if you disagree with closing. $\endgroup$ – Kuba Apr 18 '18 at 6:18
  • $\begingroup$ Thanks. Get it done by f[n_, x_] = Sin[n*x]; CloudDeploy[(Manipulate[Plot[f[n, x], {x, 0, 6}], {n, 1, 10},SaveDefinitions -> True ])] $\endgroup$ – H42 Apr 18 '18 at 6:24