Revision 27 as of 2012-10-05 08:34:36

Clear message


Matlab is a high-level language and interactive environment for numerical computation, visualization, and programming.

Start Matlab

First Steps

Matlab has a lot of tutorials by its own. You can find them in Matlab: Help - Product Help - User Guides

Matlab Compiler

How to use Matlab Compiler on Linux

This section shows an example on how to use MATLAB Compiler to code and build standalone applications.

Magic Square Example

A magic square is an array of integers arranged so that their sum is the same when added vertically, horizontally, or diagonally. Copy the following code in a text-file and save it as magicsquare.m

Important: When this programm is runned in a Linux-Terminal, we have to use the function str2num (string to number). Arguments are used as strings, thats why they have to be converted in a number in Matlab.

Compile the magicsqure function (with the command: mcc) in a Linux-Terminal

To run the magicsquare programm we give the shell-script 2 arguments. The first is the path to the Matlab Compiler Runtime.

Important: The version of the compiler Runtime needs to be same that was used by the compiler mcc.

The second argument in this example is for the programm magicsquare itself.

More help on mcc: Enter on commandline: mcc -help

Or see the Matlab-Documentation in Matlab: Help - Product Help - Matlab Compiler

Matlab on the cluster

If you get the error message: "Could not access MCRcomponent cache", you have to make it unique (make shure no other user is using the same path) and check the accessibility of this path.

Limited amount of licenses

The number of MATLAB licences is limited. To ensure a fair and efficient usage of the licences throughout the ETH the following measures have been put in place:

What can you do?

  1. Compile your MATLAB program. The best approach to avoid excessive usage of MATLAB licences is to compile your MATLAB program. The resulting executable does not need ANY MATLAB licence! This frees you from all MATLAB licence restrictions and also allows you to provide your executable to users without a MATLAB installation.
  2. Exit MATLAB when finished. Only then will all used licences be given back.
  3. Register the need for many MATLAB licences due to a MATLAB course by registering your need in advance, there can be taken countermeasures and ensure that these licences are available. Use the ides contact forumular therefore: (Nethz-login required)

  4. Buy your own MATLAB licences if you must have a guaranteed 24/7 service or if you need to use an excessive amount of licences.

How do I know which MATLAB licences I use?

How do I know how many MATLAB licences are used by whom?