I'm wondering if its possible push output from a .NET console application to an existing Notebook that is open in Mathematica.

The reason I'd like this is that I want to use Mathematica as a "debugging console" for intermediate calculations that I am performing in .NET, by pushing out text, graphics, etc.

p.s. I'm fairly familiar with C# and Mathematica, so all I want to know is if this is possible, or not.

  • 1
    $\begingroup$ It is possible via JLink (see the JLink docs for details, my quick search resulted in this link, but the updated version of this is now incorporated into the current JLink tutorial). I would guess .NET link should make this possible too. $\endgroup$ Commented Aug 29, 2012 at 8:41

1 Answer 1


See http://reference.wolfram.com/mathematica/tutorial/ManipulatingNotebooksFromTheKernel.html

If we send the following four commands to the Mathematica Kernel, via Net/Link, it will create a new notebook, and graph the result of an equation:

n = CreateWindow[]
NotebookWrite[n, "Plot[Sin[x],{x,0,6 Pi}]"]
SelectionMove[n, All, CellContents]

Here is the output in Mathematica. I think this is pretty cool: now I can use Mathematica as a kind of super charged debugging console from a .NET application, one which can plot graphic as well as print text. Any output graphs can then be interacted with, i.e. rotated, animated, etc.

enter image description here


Unfortunately, this didn't end up working at all.

The following command does not work from .NET/Link, as its a function call contained in the user interface, and not the kernel:

n = CreateWindow[]

Currently, I'm still stuck. The only option I can think of is to create a standalone Windows service that sits in the background, accepting arrays from the standalone .NET app, and serving them to a Mathematica Notebook on demand (I havn't implemented this yet).


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.