I have trouble generating and saving data from a manipulation that determines parameters. Can someone please help me?

Manipulate[Plot[{func,x}, {x, 0, 3}]

I want to save x and func results.

  • 1
    $\begingroup$ It is really difficult to give any kind of answer to this question because 1) Manipulate[Plot[{func,x}, {x, 0, 3}] is syntactically and semantically invalid. 2) You do not give specifications of what each CSV file record should contain $\endgroup$
    – m_goldberg
    May 12, 2019 at 14:07

1 Answer 1


Here is an example using Manipulate to set a parameter, then exporting data. Using the func example from Xminer's answer:

func[a_, x_] := Sin[a x]

The following Manipulate lets you set a between 1 and 10, shows the plot of Sin[a x], and defines a table data containing samples from func[a,x].

   "a = " <> ToString[a],
   Plot[func[a, x], {x, 1, 10}],
   data = Table[{a, x, func[a, x]}, {x, 1, 10, .1}];
 , {a, 1, 10}]

enter image description here

The variable data contains lists of the form {a, x, func[a,x]}, for example

data // MatrixForm

enter image description here

Then it's just a matter of exporting.

Export["filename.csv", data]

This generates a csv file that looks like this:

enter image description here

Which can then be used in Excel or imported into Mathematica.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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