Tag Info

Hot answers tagged

22

UPDATE The following steps are no longer necessary if one is using Mathematica version 9 -- it comes preconfigured to use .NET 4.0. NETLink uses an interlude .NET application to broker communication with the framework. The application is called InstallableNET.exe (InstallableNET32.exe on 32-bit systems) and can be found in this directory: SystemOpen @ ...


18

IronPython requires .NET 4.0 to run. As of V8, Mathematica launches .NET 2.x by default. See this question for details about how to use .NET 4.0. Having done that, we need to load the IronPython assembly into the .NET framework: Needs["NETLink`"] InstallNET[]; $pythonDll = "C:\\Program Files (x86)\\IronPython 2.7.1\\IronPython.dll"; ...


12

Being the fan of Mathematica<->CLR interop that I am, your question has inspired me to try to get IronPython fully working with Mathematica for the last couple of days. I haven't yet had total luck. Part of my problem is that I don't have a Windows Mathematica license, so I can't fully double-check my work. While I'm trying to hunt down Mathematica for ...


12

You don't need the initial InstallNET[]. That should come after Needs["NETLink"]. I made a post on this topic a while back, here: http://forums.wolfram.com/mathgroup/archive/2011/Oct/msg00386.html Some code to illustrate the method: Needs["NETLink`"] ReadFromExcel[file_String, cell_String, rows_Integer, cols_Integer] := Module[{excel, workbook, ...


11

Yes, it is, but it's cumbersome (at least as of Mathematica 8). The hardest part is that you have to manually do a lot of the juggling required to work with .NET generics and extension methods. For example, let's translate a straightforward solution to Project Euler's Problem #1 ("Add all the natural numbers below one thousand that are multiples of 3 or ...


10

AFAIK there is no equivalent to the Matlab builder (yet?). There are some similar functionalities but, as far as I understand and know, there is nothing that would perfectly match what you seem to need. For deploying functionality written in Mathematica for use from a C# program I see these three possibilities: Deploy as Mathematica-Application (with GUI) ...


8

Even the path is corrected, it still cannot run, since the argument type should {"double*", "double*"}. Here is my memo on calling dll created by gortran using NETLink: Advantages of NETLink as compared to Mathlink: FORTRAN functions and subroutines can be called using .NET/Link without writing additional C wrapper which is necessary in Mathlink. ...


8

Here is an idea - it's by no means perfect, but then again, the comments indicate that there won't be a perfect solution: In your .NET application, create a web view (I don't know the details for this, but that would go beyond the scope of this forum anyway - I've done similar things in Cocoa on Mac, so you should be able to find analogous libraries for ...


7

Per request, I'm posting this as an answer: The same problem is mentioned in the following support article: http://support.microsoft.com/kb/320369 The problem appears if the language of Excel differs from the locale setting of the operating system. One workaround is to set the system locale to match with the language of Excel (probably US English for ...


7

To use .NET/Link from a Mono program, you need to make sure that the system can find the MathLink shared library. This generally means adding the appropriate path to an environment variable that the system uses for library lookups. You can do this is in the standard way that is appropriate for your OS/shell program, either in a shell config file or on the ...


6

This is apparently a 32-bit COM object, so you need to force .NET/Link to run in 32-bit mode: Needs["NETLink`"]; ReinstallNET["Force32Bit" -> True]; p = CreateCOMObject["PinPoint.Plate"] Generally, the only time you need to worry about bit-ness issues is when you are calling non-.NET code, such as a 32-bit DLL via DefineDLLFunction or, as here, a ...


6

The command line option to call the kernel with to suppress the taskbar button is -noicon. You need to pass this flag to MathKernel.exe when launching it. Here's a demonstration from within Mathematica: kernel = LinkLaunch[First[$CommandLine] <> " -mathlink -noicon"] This will launch a new kernel and connect to it. On Windows, the new kernel will ...


5

If you'll accept solutions involving other technologies, then how about using sed? On a unix system, to read in file1, delete row n and output to file2, you'd do: sed -e 'nd' file1 > file2 The quotes in 'nd' are not necessary in this case, since there is only one instruction. However, if you're doing more complicated stuff with regular expressions, you ...


5

Here is a way to invoke System.DateTime.FromOADate using NETLink: Needs["NETLink`"] InstallNET[]; LoadNETType["System.DateTime"]; fromOADate[d_] := DateList @ NETBlock @ System`DateTime`FromOADate[d]@ToString[] Note, however, that FromOADate does not share Excel's backward-compatible implementation of Lotus 1-2-3's date bug. To see this, we introduce ...


5

I've got VBA calling Mathematica functions. It's not without issues, but maybe some other smart people here can help with the hiccups. First things first: The .dll that Mathematica includes with its installation for .NETLink is not COM-compatible, meaning that VBA cannot find entry points into the dll functions. To get around this, .NET must be installed ...


4

I am answering my own question to help out other .Net/Mathematica developers in the future. I am using random file names (DTWERG, ERYFGJ, IYIGGD) and it turns out when Mathematica exports an image file that has a slash and followed by : b, t, n, f, r it recognises/honors the escape slash. For example when a file name starts with an r as per the ...


4

The solution which worked for us may not be practical for you, but we faced a similar scenario. However, we also knew that across all our users, the actual times that a call to MMA would be needed would be few and far between. The answer for us is a small pool of floating licenses for MMA. That said, Wolfram were very helpful, and for a large scale ...


3

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] ...


2

To evaluate a notebook from .NET, a batch file and a package file can be used. This example opens and evaluates a notebook called "run.nb" in the front end. Ref:- http://stackoverflow.com/q/7626491/879601 i.e. batch file:- @echo off setlocal PATH = C:\Program Files\Wolfram Research\Mathematica\8.0\;%PATH% start MathKernel -noprompt -initfile ...


2

Success!! I didn't know where to put the packages, or didn't want to put them in the place designed for them. I evaluated $UserBaseDirectory in a Mathematica session. In that directory is the pre-established Applications folder where you are supposed to put your work. This is your private Applications folder. Say you are doing extended work on TopicX. ...


2

The next best thing would be to use NET/Link to open Mathematica notebooks, see: How to output from a .NET console app to an existing Notebook in Mathematica? Of course, this would require that Mathematica is installed on the target system, but for debugging uses it would be simply perfect.


1

Not sure if this will help you but there is already some stuff that gets bundled with Mathematica, which on a Mac can be found here: /Applications/Mathematica.app/SystemFiles/Links/Python There is also this http://code.google.com/p/pythonika/ which has been around for awhile.



Only top voted, non community-wiki answers of a minimum length are eligible