matlab alternatives and similar packages
Based on the "Foreign" category
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of matlab or a related project?
This is an updated version of Dylan Simon's matlab package which is available on Hackage. I made changes primarily to allow the package to work with newer versions of GHC and MATLAB.
You will probably need to add some arguments that point Cabal to your MATLAB installation. For example, on a Linux system with MATLAB R2014a, it may look like this:
cabal install --extra-lib-dirs="/usr/local/MATLAB/R2014a/bin/glnxa64/" --extra-include-dirs="/usr/local/MATLAB/R2014a/extern/include/"
On a Windows system with the MATLAB Compiler Runtime, it might look like this:
cabal install --extra-include-dirs="C:\Program Files\MATLAB\MATLAB Compiler Runtime\v83\extern\include" --extra-lib-dirs="C:\Program Files\MATLAB\MATLAB Compiler Runtime\v83\bin\win64"
These instructiosn are much the same as the Cabal instructions above.
--nix argument if not using Nix or NixOS)
$ stack --extra-lib-dirs=$MATLAB_PATH/bin/glnxa64 --extra-include-dirs=$MATLAB_PATH/extern/include --nix build
IMPORTANT Caveat: If it is necessary to specify the
matlab shell script should instead be modified to hardcode
glnxa64. Aside from convenience, certain APIs like the MATLAB Engine API
will not always work otherwise (you will likely see an error involving
These instructions assume
stack is to be used in a Nix environment. If you don't already
have stack in our environment you can add it, or likely you can just run
to load stack and other dependencies.
You can load a MATLAB nix shell such as the one found in
shell.nix - feel free
to modify it to add other packages for your particular project; in this case
deps.nix. What is important to keep in mind about
shell.nix is that it is
configured to be used by
stack in the
stack.yaml file, but you could also run
nix-shell shell.nix (or simply
nix-shell in the current directory) to load an environment
in which you could run MATLAB as well.
Confirm it is working by running
matlab -nodisplay -nosplash.
Build the project using the build command above under "Stack notes".
This package has been confirmed to work on the following systems:
|GHC version||cabal-install (c) or stack (s) version||Operating System||MATLAB|
|8.6.5||22.214.171.124 (s)||Ubuntu 18.04||MATLAB R2018a|
|8.6.5||126.96.36.199 (s)||NixOS 19.09||MATLAB R2017a|
|7.8.3||188.8.131.52 (c)||Ubuntu 14.10||MATLAB R2014a|
|7.8.3||184.108.40.206 (c)||Windows 7||MCR R2014a|
Note that this requires shell program
csh to be installed at
This is a requirement of the MATLAB Engine API. Instead of
may also be used as long as
/bin/csh points to the
After installing, you can run a particular exectuable (e.g.
matlab-engine-test) using the
script. You need to make sure
MATLAB_PATH is set correctly or passed in.
stack --nix install ./runHSMat.sh matlab-engine-test
Option 2 (not working yet)
See MATLAB Engine API for C for details.