New THOTH website available here

LEAR Frequently Asked Questions about Matlab

Basics and policy

MATLAB is available on /home/clear/lear/matlab. This will use licenses from the LJK Laboratory, and run the latest MATLAB installed. LJK licenses are reserved for teaching and pure research: they MUST NOT BE USED for deliverables (European projects, etc) or commercial developments.

You can also run /softs/stow/matlab-*/bin/matlab, this way you will use INRIA licenses, of which there are only few since they are very expensive as INRIA does not get the educational discount.

Please exit MATLAB as soon as you have finished using it (add exit at the end of your scripts), otherwise you are waisting licenses=money. Or, consider using octave instead (=free). Use:
/home/clear/lear/matlab -nodesktop -nojvm -r \"cd my_dir;my_script_to_run('\$BASH_VAR'); exit\"
if you want to run a script from the command line use. Note that you can pass shell variables to MATLAB (it can be very handy!).

How can I access MOSEK from Matlab

MOSEK can be launched in MATLAB with the commands:

How do I know who is using MATLAB licenses? How do I release or return a license key of a ToolBox back?

To find which lincences are cheked out run the following command:

/softs/stow/matlab-2014b/etc/glnxa64/lmutil lmstat -a

You may have to add a -c licensefile option to set the relevant license file, which is referenced in /home/clear/lear/matlab script.

Toolbox license keys only get checked back in when the main MATLAB session is ended regardless of whether the toolbox is still being used. So if you do not want to quit, to release the key:

/softs/stow/matlab-2014b/etc/glnxa64/lmutil lmremove TOOLBOXNAME USERNAME COMPUTERNAME DISPLAYNAME

Just to illustrate with an example:

/softs/stow/matlab-2014b/etc/glnxa64/lmutil lmremove Image_Toolbox dorko /dev/pts/15

All required information can be found in the output of lmutil lmstat -a

IMPORTANT: ONLY REMOVE YOURSELF, or ask holder of the licence first!

A few guidelines for efficient Matlab coding:

What can I do if there are really no Matlab licenses left?

You can use Octave instead, which is mostly compatible with Matlab. Strong points of Octave:

The main drawbacks are:

In any case, it is good discipline to validate that the Matlab code that you write also runs on Octave.

Another free Matlab wana-be is Scilab, but its syntax is quite different and tends to segfault too often.

Finally, another nice and open source alternative to Matlab can be obtained via the Python language and its Numpy and Scipy libraries, but the syntax is completely different.

How do I use the matlab compiler mcc?

Here is a simple example for a file test_mcc.m
function [] = main(seed)
if isdeployed    % true only in compiled mode
   seed=str2num(seed);  % in compiled mode, arguments are only strings
fprintf('random number: %f\n',rand(1));
You can compile this function by using the command:
/softs/bin/mcc -m test_mcc.m -R -singleCompThread -R -nodisplay
-R allows you to pass different matlab options.

Then, to run the function, without using any licence,
sh /scratch2/clear/mairal/MCR_matlab2013a/v81/ 9
9 is the argument ``seed'' in test_mcc.m

You have to use at least Matlab version 2013a (installed in /softs/stow/matlab-2013a/bin).

What can I do if gfortran does not compile well MEX files?

You can try and copy:
/home/lear/douze/.matlab/R2012b/ into:
~/.matlab/R2012b .