Computer Laboratory

MATLAB

MATLAB is a commercial programming language and environment for numerical computations. Numeric arrays are its primary data type. MATLAB gives easy access to a wide range of efficient numeric algorithms, visualization techniques, and domain-specific extensions (“toolboxes”). The Computer Laboratory holds a license for research applications not included in the Campus agreement.

Using MATLAB in the department

For Linux, there is no RPM/Debian package available for MATLAB, therefore the current version is installed for everyone under /usr/groups/matlab/current on the filer. Care is taken to ensure that this is in step with the licence server. Some Linux machines have a local command cl-matlab installed to access the current version from the default path.

Windows users have to install MATLAB on their local harddisk The current version is available on \\filer\install\matlab2012b.

You should carry out a non-network install and use first the Campus PLP which is 26253-60895-63607-64029-56763-30029-04260-35092. After this install is complete you may need to install again if you find that there are missing toolkits. Do so using the CL PLP 65201-02745-31804-62484-18267. It is not worth adding the extra toolkits unless you actually want to use them.

In any case make sure your license file has in it:-

    SERVER lmserv-matlab-research.cl.cam.ac.uk 0011116e04b4 2700 
    USE_SERVER

Using Matlab at home

As a member (Staff, RA or Research Student) of the Computer Laboratory, you can use the department’s MATLAB licence also on your home computer.

To do so, you need two things:

  • A connection to a Computer Laboratory MATLAB license server.
  • The MATLAB software.

However, it is recommended that you use instead a site licensed copy of the the software that does not need access to the license server unless you need one or more of the toolkits not included in the site license but licensed to the department. To obtain this contact Graham Titmus.

Tunneling to the licence server

To use MATLAB, you need two TCP connections to a departmental MATLAB licence server. For members of the department, the server is lmserv-matlab-research.cl.cam.ac.uk using TCP ports 2700/2701. Some care is necessary to get this working, because these ports are blocked from outside access by the departmental firewall. Best establish this connection, as described below, before actually installing MATLAB, because this way the installation process can talk to the licence server and install exactly the components for which you can get a licence.

Windows

Under Windows, as a member of the department, simply activate a Computer Lab VPN connection to circumvent the departmental firewall.

Linux

Under Linux, use this script to establish an ssh tunnel connection to the departmental MATLAB licence server:

#!/bin/bash
# Open ssh connection to the Computer Laboratory and tunnel
# matlab licence server ports
cat <<'EOF'
The following local ports are now forwarded via SSH to the Computer Lab:

  localhost:2700  ->  lmserv-matlab-research.cl.cam.ac.uk:2700
  localhost:2701  ->  lmserv-matlab-research.cl.cam.ac.uk:2701
EOF
ssh -N -x \
    -L 2700:lmserv-matlab-research.cl.cam.ac.uk:2700 \
    -L 2701:lmserv-matlab-research.cl.cam.ac.uk:2701 \
    slogin-serv1.cl.cam.ac.uk

Note: A more fancy version of the above script, which also tunnels rdesktop, http, Kerberos authentication, SMB/CIFS access to elmer, and access to the Altera licence server, can be found at /home/mgk25/w/scripts/tunnel-cl.

Installing MATLAB

If possible install the Campus licensed version alone.

Members of the department who wish to install the CL toolkits on a home desktop machine should contact Graham Titmus. Laptops should be brought into the department to be installed.

Install according to instructions. As you have already a File Installation Key, choose “Install manually without using the Internet”. You do not have to install the licence manager on your machine, as you will be using the one installed in the Computer Laboratory.

During the installation process, you will be asked for your local license.dat file. Members of the department set this to:

  SERVER localhost 0011116e04b4 2700
  USE_SERVER

This tells MATLAB to contact these ports on your local machine, where your ssh tunnel will forward the connection to the respective licence server.

For comparison: The /usr/groups/matlab/current/etc/license.dat file used on Computer Lab Linux machines contains the line

  SERVER lmserv-matlab-research.cl.cam.ac.uk 0011116e04b4 2700

This is the real network address of the licence server, along with the Ethernet MAC address to which its licence has been tied and the first of the two ports to contact.

After installation, you may also want to change .../toolbox/local/docopt.m to point to your favourite web browser.

Important

Please be social. Do not forget to quit MATLAB as soon as you are not using it. Remember that others in the lab may already be queueing to use the licences that you block. The etc/lmstat -a command will show you who currently uses which license.

Running MATLAB on your home PC this way is a HACK, not an officially supported service. It is perfectly proper and legal, because you still use a valid licence, but it comes without any support from sys-admin staff.

Alternatives

While MATLAB has probably been one of the most popular numerical environments for the last two decades in many research disciplines, there are now several free alternatives available:

  • The NumPy package adds to the Python programming language the main features that distinguished so far Matlab from other programming languages: powerful N-dimensional numeric array objects and efficient linear-algebra and Fourier-transform functions that operate on these. Have a look at NumPy for Matlab Users. The Matplotlib package adds on top of NumPy visualization facilities that are very comparable with those of MATLAB, and comes in addition to a native object-oriented API also with an alternative PyLab API that is designed to be very familiar to experienced MATLAB users. The SciPy library adds to all that a number of further algorithms for scientific computing.
  • Octave is a free reimplementation of the MATLAB programming environment.
  • Scilab is another open-source contender in this field.

You may want to try Octave if you are looking for a compatible drop-in replacement for MATLAB. Try Python + NumPy + Matplotlib if you are looking for a much neater and more flexible programming language that offers comparable capabilities and is much easier to use as a scripted environment (CGI, Makefile, etc.).

We don't know of a recommended free alternative for Simulink (perhaps GNU Radio for radio communications projects). There is also not quite as rich a set of domain-specific toolboxes available for MATLAB alternatives as there is for the original, and you may find the documentation somewhat more rudimentary.

More information