By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,258 Members | 1,213 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,258 IT Pros & Developers. It's quick & easy.

Using Mathematica to plot in Visual Studio

P: n/a
Hello

I am using Visual Studio 2005 beta and Mathematica 5.0.
I was trying to make an application (in c#) which would allow me to use
Mathematica functions like Plot[], ListPlot[] etc and show the
resulting plot in a picturebox in the form.

I read the .NETLink API and tried to run the sample code:

private void computeButton_Click(object sender, System.EventArgs e)
{
if (mathKernel.IsComputing) { mathKernel.Abort();}
else {
computation.resultBox.Text = "";
messagesBox.Text = "";
printBox.Text = "";
graphicsBox.Image = null;
computeButton.Text = "Abort";

mathKernel.Compute(inputBox.Text);
computeButton.Text = "Compute";

// Populate the various boxes with results.
resultBox.Text = (string) mathKernel.Result;
foreach (string msg in mathKernel.Messages)
messagesBox.Text += (msg + "\r\n");
foreach (string p in mathKernel.PrintOutput)
printBox.Text += p;
if (mathKernel.Graphics.Length > 0)
graphicsBox.Image = mathKernel.Graphics[0];
}
}
But when I run this application and press the compute button, a window
opens up which says "Choose a MathLink program to launch" and asks me
to select an exe file.
I have no idea what is happening.

Could someone please guide me on what to do.

Thanks in advance.

Siddharth Jain

Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hello,

This is just a wild guess, but probably you are not running the
mathematica kernel, which is needed to perform the calculations. That
might be the reason why the dialog box asks you to choose a "MathLink
program". Try chooseing the Mathematica Kernel .exe (if such thing exists).

Siddharth Jain wrote:
Hello

I am using Visual Studio 2005 beta and Mathematica 5.0.
I was trying to make an application (in c#) which would allow me to use
Mathematica functions like Plot[], ListPlot[] etc and show the
resulting plot in a picturebox in the form.

I read the .NETLink API and tried to run the sample code:

private void computeButton_Click(object sender, System.EventArgs e)
{
if (mathKernel.IsComputing) { mathKernel.Abort();}
else {
computation.resultBox.Text = "";
messagesBox.Text = "";
printBox.Text = "";
graphicsBox.Image = null;
computeButton.Text = "Abort";

mathKernel.Compute(inputBox.Text);
computeButton.Text = "Compute";

// Populate the various boxes with results.
resultBox.Text = (string) mathKernel.Result;
foreach (string msg in mathKernel.Messages)
messagesBox.Text += (msg + "\r\n");
foreach (string p in mathKernel.PrintOutput)
printBox.Text += p;
if (mathKernel.Graphics.Length > 0)
graphicsBox.Image = mathKernel.Graphics[0];
}
}
But when I run this application and press the compute button, a window
opens up which says "Choose a MathLink program to launch" and asks me
to select an exe file.
I have no idea what is happening.

Could someone please guide me on what to do.

Thanks in advance.

Siddharth Jain

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.