MATLAB/Note

From ScientificComputing
Jump to: navigation, search

Configuring the ETH proxy server in Matlab

You can configure MATLAB to use a proxy:

com.mathworks.mlwidgets.html.HTMLPrefs.setUseProxy(true)
com.mathworks.mlwidgets.html.HTMLPrefs.setProxyHost('proxy.ethz.ch')  
com.mathworks.mlwidgets.html.HTMLPrefs.setProxyPort('3128') 

You need to run this just once per version.

Alternative to MATLAB

There is a freely available alternative to MATLAB, which is called Octave. It understands most MATLAB programs. It is not directly compatible with Matlab toolboxes but alternatives to some toolboxes exist.

Compiling MATLAB programs

MATLAB programs can be compiled into standalone executable programs using the Matlab Compiler mcc. A key benefit is that the compiled program does not check out a Matlab license. However, many toolboxes can not be used with compiled programs.

A function simulation defined in a file simulation.m is compiled into a standalone executable program simulation using the

mcc -m -R -nodisplay -R -nojvm -R -singleCompThread simulation.m

command. Note the dashes in front of the options, especially -R -singleCompThread.

To run the program, execute it through the generated script, which is call run_simulation.sh, where simulation is the name of your script.

sbatch --wrap="./run_simulation.sh $MATLAB"

The script needs the $MATLAB argument, which is defined when the appropriate Matlab module is loaded.