MATLAB does not have a built-in package manager, so you'll need to use the postInstall script to download and install additional toolboxes. The shell script below downloads the CVX archive from the CVX Research website using curl
¹, extracts it using tar
, and runs the MATLAB command that sets up the toolbox:
#!/bin/bash
curl -s http://web.cvxr.com/cvx/cvx-rd.tar.gz | tar zx
matlab -nodisplay -r "cd cvx; cvx_setup()"
VLFeat:
VLFeat can be similarly installed using the following script (first, install build-essential
through apt-get):
#!/bin/bash
set -ex
VLFEAT_RELEASE=0.9.20
curl -L http://www.vlfeat.org/download/vlfeat-$VLFEAT_RELEASE-bin.tar.gz | tar xz
cd vlfeat-$VLFEAT_RELEASE
make clean
make
matlab -nodisplay -r "addpath('/vlfeat-$VLFEAT_RELEASE/toolbox'); vl_setup; savepath;"
(Note that the make clean
and make
steps may not be necessary for your capsule, and that you should set VLFEAT_RELASE
to whatever your code needs.)
Mosek:
MOSEK has kindly provided a license for use on Code Ocean, and can be installed by adding bzip2
as apt-get dependency and using the following script:
#!/bin/bash
MOSEK_RELEASE=8.1.0.31
curl -sL https://d2i6rjz61faulo.cloudfront.net/stable/$MOSEK_RELEASE/mosektoolslinux64x86.tar.bz2 | tar xj
matlab -nodisplay -r "addpath('/mosek/8/toolbox/r2014a');"
YALMIP:
Similarly, YALMIP can be installed together with MOSEK (first, please install bzip2 via apt-get) using the following script:
#!/bin/bash
YALMIP_RELEASE=R20171121
MOSEK_RELEASE=8.1.0.31
curl -sL https://github.com/yalmip/YALMIP/archive/$YALMIP_RELEASE.tar.gz | tar xz
curl -sL https://d2i6rjz61faulo.cloudfront.net/stable/$MOSEK_RELEASE/mosektoolslinux64x86.tar.bz2 | tar xj
matlab -nodisplay -r \
"addpath('/mosek/8/toolbox/r2014a'); addpath(genpath('/YALMIP-$YALMIP_RELEASE')); savepath;"
(For an example capsule with YALMIP and MOSEK installed, see See Optimal Precoders for Tracking the AoD and AoA of a mmWave Path.)
libsvm:
For libsvm, add the build-essential
package (that includes make
and gcc
, among others) as an apt-get dependency so that the MEX files can be compiled. Here's a script that installs version 3.20 from GitHub:
#!/bin/bash
set -ex
curl -sL https://github.com/cjlin1/libsvm/archive/v320.tar.gz | tar xz
cd libsvm-320/matlab
make all MATLABDIR=/MATLAB -j$(nproc)
matlab -nodisplay -r "addpath('$PWD'); savepath"
SeDuMi:
mkdir deps && cd deps
curl -L https://github.com/sqlp/sedumi/archive/master.tar.gz | tar xz
cd ..
matlab -nodisplay -r "addpath(genpath('deps')); savepath"
EPANET-Matlab Toolkit:
EPANET-Matlab Toolkit
is an open-source software, originally developed by the KIOS Research and Innovation Center of Excellence, University of Cyprus which operates within the Matlab environment, for providing a programming interface for the latest version of EPANET, a hydraulic and quality modeling software created by the US EPA, with Matlab, a high-level technical computing software.
#!/usr/bin/env bash
set -e
curl -L https://github.com/OpenWaterAnalytics/EPANET-Matlab-Toolkit/archive/v2.2.1.tar.gz | tar xz
cd EPANET-Matlab-Toolkit-2.2.1
cd epanet_matlab_toolkit
mv ./glnx/libepanet2.so libepanet.so
matlab -nodisplay -r "addpath(genpath('$PWD')); savepath"
"cURL". wikipedia.org.