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
In this section how to compile and execute M-file on "blade" is described.
$./mcompile.sh [M-filename without ".m"] [argument 1] [argument 2] ...
function [M-filename without ".m"]Then, define required variables in the M-file.
function hoge (a, b) %Add the following description before other commands. if (isdeployed) a = str2num(a); b = str2num(b); end %end …
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 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) if(isdeployed) num = str2num(num); end x=1; for i = 1:num x=x*i; end display(x); save(savefile,'x'); return
Instead of using mcompile.sh, you can call command in MATLAB "" by "mcc -m [M-filename]"