62

2014-04-12 NOTICE: MATLAB R2014a contains a bug that breaks MATLink on OS X and Linux (Windows is fine). If you use MATLink on OS X or Linux, please consider keeping MATLAB R2013b until R2014b comes out. Due to the nature of the problem there is no quick workaround that we could apply in MATLink. For full compatibility with Mathematica 10, please upgrade ...


39

Here is a package which does what you want: https://github.com/arnoudbuzing/webunit Clone the repository from github, and place the WebUnit folder under $UserBaseDirectory/Applications To use it: Needs["WebUnit`"] InstallWebUnit[] (* launches chromedriver.exe *) StartWebSession[] (* launches Chrome web browser, assuming you have that installed *) ...


35

Here are three very simple examples to show how to call a Fortran subroutine using LibraryLink. First the subroutine is compiled into object file. Then a wrapper is used to call the Fortran subroutine and compiled into dynamic library. At the end, the library is loaded into Mathematica and run. In the examples Mathematica Version 8 is used. FIRST EXAMPLE ...


34

You can use the binary format to speed up the process: python side import numpy as np array = np.random.rand(100000000); array.astype('float32').tofile('np.dat') Mathematica side data = BinaryReadList["np.dat", "Real32"]; // AbsoluteTiming (* {2.56679, Null} *) data // Dimensions (* {100000000} *)


33

Get all the files here. .NET Mathematica Word Library You will need to use a Microsoft library to open word documents. In a language such as .Net it is very easy; just open Visual Studio, reference the Microsoft.Office.Interop.Word .NET DLL (for Words) and the C:\Program Files\Open XML SDK\V2.5\lib\DocumentFormat.OpenXml.dll (for Formulas in the MathML ...


32

This is a good application for the highly underused Splice function which has been in Mathematica since version 1 (I don't recall it ever being used on this site). Create a file called main.mtex with the following text: \documentclass[preview,border=12pt,12pt]{standalone} \usepackage{amsmath} \def\f(#1){(#1)^2-5*(#1)+6} \begin{document} \section{Problem}...


31

Mathematica 12.0 brings two new features that make this easier to do than it was before: ExternalFunction Wolfram Client for Python Below we implement a function nxFunction that automatically handles translating Mathematica expressions of interest to Python, as well as converting the results back. The usage will be nxFunction["someNetworkxFunction"][...


27

Update: I am no longer maintaining IGraphR. I recommend that you transition to IGraph/M instead. If you need a feature that IGraph/M does not yet have, please submit a feature request. I wrote a small package for this. The main reason why I'm posting it here is to get some feedback on how to improve it. I'm new both R and RLink. You can get the package ...


24

I assume you have Maple to use. If so, Simply open Maple and type the Mathematica command itself directly into Maple using the FromMma package built-into Maple, like this: restart; with(MmaTranslator); #load the package (*[FromMma, FromMmaNotebook, Mma, MmaToMaple]*) and now can use it FromMma(`Integrate[Cos[x],x]`); One can also use Maple convert ...


23

Note: I added an update below to import position and orientation transformations and view the 3D simulation results in Mathematica. I have used the free program Blender v2.79b to simulate the handling of 100s of complex shapes through a geometrically complex industrial machine with many moving parts including vibrating elements. So, it should be able to ...


22

I now have part of the picture. There is an undocumented function called HTTPClient`OAuthAuthentication[] which takes only options as arguments. These options settings override defaults that are visible in HTTPClient`OAuth.m. Here is an example of how to make get an OAuth 1.0a style access token, in this case for the Withings API: token = HTTPClient`...


22

You can install the LiveWeb plugin for PowerPoint which allows to embed a live webpage into a slide. Now you should prepare an HTML page with emdedded CDF object (here and here you can find old instructions how to do this, but probably there is easier way now) and embed it into a PowerPoint slide. People say that it works surprisingly well and you maintain ...


22

The Run command returns the exit code of the program being run. In your case, the program is "!ls" which probably doesn't exist on your system (If you try sh -c '!ls -la $HOME' you'll also get an error). Why it returns 32512 instead of 127 (which is the return value I get by the shell) I don't know; however I notice that $32512 =127\cdot 256$, so I guess ...


21

You can call an external (shell) command cmd without showing a command window by using the pipe syntax "!"<>cmd. This can be used in place of a filename with any Mathematica function that opens a file for reading. For example: Import["!dir", "Text"] Read["!dir"] (opens stream, must be closed) OpenRead["!dir"], followed by Read, ReadList etc to grab ...


20

Building off of @M.R.'s idea, it is possible to set up an interactive python shell using StartProcess as opposed to RunProcess, allowing for much more flexible connectivity between Python and Wolfram without as much overhead. In it's simplest form, one can open a connection, interact with it, and close it using the following example: path = "e:\\Programs\\...


19

Begin Note: I have successfully got this working in the following environments. On a Mac PC running version 9.0.0.0 using a locally installed JRE (version 1.6.0_37). On a Windows PC running version 9.0.0.0 using a locally installed JRE (version 1.7.0_13). I found that on my Windows PC, the JRE included with Mathematica is version 1.6.0_10 and the method ...


19

Does this do the job? links = Import[ "http://www1.ncdc.noaa.gov/pub/data/cmb/drought/weekly-palmers/2005/", "Hyperlinks"] {"http://www1.ncdc.noaa.gov/pub/data/cmb/drought/weekly-palmers/2005/?C=N;O=D", "http://www1.ncdc.noaa.gov/pub/data/cmb/drought/weekly-palmers/2005/?C=M;O=A", "http://www1.ncdc.noaa.gov/pub/data/cmb/drought/weekly-palmers/...


18

Have a look at this; http://reference.wolfram.com/mathematica/guide/MathLinkCLanguageFunctions.html I haven't used it in C/C++ but it works fine in C# and Java. Basically you create a connection to a Mathematica kernel and then pass it native data types. Works nicely. Here is some sample code in Java that I used when I first did this; import com.wolfram....


18

I consider this question pretty much answered by @MarcoB, as follows: Mathematica 10 apparently forces rasterization by default when exporting 3D graphics to PDF, even when one adds the option "AllowRasterization" -> False to Export. The only way to disable it is to use the Inset workaround suggested by Jens: Export["PDFTestExport.pdf", Graphics[Inset[g,...


17

Here is a more robust solution using Process: Clear[runPython]; runPython::badCommand ="Python code failed to run with message `StandardError`"; $pyimports="from random import randint "; runPython[str_String, imports_:$pyimports] := Module[ {pyscrpt = ToString[$pyimports<>str, CharacterEncoding->"ASCII"], file=CreateTemporary[], res}, ...


16

You can open a whole Mathematica notebook in Maple using its Open... menu, and all expressions in the notebook will be converted to Maple representation:


16

You create metafiles every time when you copy graphics from Mathematica FrontEnd and paste it in MS Word because it is native format for exchanging vector graphics under Windows. So your question is actually about corrupted metafiles in MS Word document opened on a machine without Mathematica fonts installed. This behavior is expected because unlike PDF and ...


16

If you need to achieve the best possible quality I strongly recommend against using the Clipboard for transferring graphics. Under Windows the clipboard will contain a Windows Metafile generated with display resolution fidelity! This is the reason why you see jaggies. The same is true for the vector graphics files generated by Mathematica's Save Selection ...


15

In terms of loading C++ functions, I would strongly suggest LibraryLink. It is a great tool except that it requires you to write sometimes intimidating C code. To make LibraryLink easier to use, I have developed a package called wll-interface, available in this github repository. It is a header-only library written in C++, doing only one thing—...


15

To call Mathematica from Clojure, you will want to use Clojure's Java interop to access the Wolfram JLink classes to script Mathematica access. Start by launching Clojure with a classpath that includes the JLink.jar, for example with this batch file: @echo off set MATHEMATICA=C:/M/9.0 set JLINKJAR=%MATHEMATICA%/SystemFiles/Links/JLink/JLink.jar java -cp C:/...


15

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


14

There is a package called LTemplate that automates writing some of the boilerplate code for LibraryLink: How to simplify writing LibraryLink code? I consider this less effort than writing standard LibraryLink code. In this sense it is a fitting answer for this question. However, I do recommend familiarizing yourself with the standard way of using ...


14

Mathematica 9 includes an RLink feature.


14

Since 11.2 Mathematica has supported ExternalEvaluate and since 11.3 this functionality has been conveniently available simply by beginning an input cell with > which produces an external code cell: The output of these cells is a Wolfram Language expression that you can then compute with.


14

To overcome some limitations of RLink with regard to performance and parallelizability, I also created a LibraryLink based interface to igraph: IGraph/M Since the original release, IGraph/M has grown into a large package of ~300 functions that is not only an igraph interface, but also provides many unique functions for working with graphs in Mathematica. ...


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