Laboratories for Mathematics, Lifesciences, and Informatics

Top / MATLAB (English version)

MATLAB (English version)


*Introduction of MATLAB [#c257637a]

*How to install (Short) [#u665d84f]

*How to install (Full) [#m2fbc845]

*Setting the library path [#pbc57d3f]

You need to configure the library path to use  MATLAB compiler.
Open ".bashrc" and add the following description.
 export MATLABROOT=/usr/local/MATLAB/R2011a
 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MATLABROOT/bin/glnxa64:$MATLABROOT/extern/lib/glnxa64:$MATLABROOT/sys/os/glnxa64:$MATLABROOT/runtime/glnxa64

*Remote connection [#jfcf0f7e]

*MATLAB compiler [#jb1b6760]
In this section how to compile and execute M-file on "blade" is described.

+download the following file and put it to the same directory as the M-file you want to execute.
((Instead of using, you can call command in MATLAB "" by "mcc -m [M-filename]"))
+Log in to the blade you execute the calculation. You don't need to start X server.
+Execute the script by the following way.
 $./ [M-filename without ".m"] [argument 1] [argument 2] ...

-Advantage of MATLAB compiler
--You can execute calculations without using MATLAB license.
--In some case the calculation becomes fast.

--You can only compile "function M-file".
In case you are using "script M-file", add the following sentence to the line 1.
 function [M-filename without ".m"]
Then, define required variables in the M-file.
---function M-file: Executed as function, in other words, there are arguments and return values. Variables are available only in the file and the use of variables is limeted to the inside of the fuction.
---script M-file: Processing is described in order.
Variables are shared by before and after calculation.

--Use save/load command as a function setting down the target file.
--When you need arguments, modify the M-file as follows.
 function hoge (a, b)
 %Add the following description before other commands.
  if (isdeployed)
   a = str2num(a);
   b = str2num(b);

--You cannot draw "figure". As you cannot get return value, save results to files.
--When compiling is failed, proseccing is stopped by MATLAB command prompt.
Then, please end MATLAB in order to stop using the license

-sample source code (&ref(sample_func.m);)
 % sample code of Matlab compile (last update 2012/4/11)
 % 1. compile (in Matlab):
 %  $mcc -m sample_func
 % 2. execution example (in command terminal):
 %  $./sample_func 5 save_data.mat
 function sample_func (num, savefile)
    num = str2num(num);
  for i = 1:num