Springe direkt zu Inhalt

MATLAB

MATLAB is a numerical computing environment.

Support

If you have a problem with MATLAB on your own computer or any other non-HPC system, please seek help from service@fu-berlin.de.

Only in case of difficulties with MATLAB on the HPC system should you write to hpc@zedat.fu-berlin.de.

Introduction

MATLAB is a numerical computing environment. To use MATLAB, load the appropriate module, e.g:

module add MATLAB/R2019b

The MATLAB program itself is run in the script in the following way:

matlab -nodisplay -nosplash < my_program.m

If you need to pass arguments to a function defined in a MATLAB file, say, my_fuction.m, the following is possible:

matlab -nodisplay -nosplash -r "my_function(${foo}, ${bar})"

It is possible to use MATLAB interactively, but only within an interactive job.  Working interactively directly on the login node is not allowed and such processes will be terminated without warning.

MATLAB Compiler

When MATLAB is started, either interactively or within a batch job, a license is required. As we have only a limited number of licenses, this restricts the number of instances which can run simultaneously. However, in many cases, a MATLAB script can be compiled using the MATLAB compiler to produce a stand-alone program, which can run without the need for a MATLAB license. Thus, the batch system can be used to run an arbitrary number of such a compiled programs simultaneously.

A MATLAB program hello_world.m is compiled in the following way:

module add MATLAB/R2018b
mcc -mv -R -singleCompThread -R -nodisplay hello_world.m

This will generate a shell script with the suffix  .sh. The batch file to run this shell script has to include the following lines:

module add MATLAB/R2018b
./run_hello_world.sh $MCR_HOME

Please note that any further arguments passed will be interpreted as strings. Thus, it may, say, be necessary to convert these to integers with str2num.

Keywords