(1) まず、次のように Makefile を作成しました。
MATLABROOT=/usr/local/MATLAB/R2011b
all: engdemo
engdemo:
$(MATLABROOT)/bin/mex -f $(MATLABROOT)/bin/engopts.sh $(MATLABROOT)/extern/examples/eng_mat/engdemo.cpp -o engdemo
clean:
rm -f engdemo *.o
(2) 「make」コマンドで実行したところ、次の出力が得られました。
/usr/local/MATLAB/R2011b/bin/mex -f /usr/local/MATLAB/R2011b/bin/engopts.sh /usr/local/MATLAB/R2011b/extern/examples/eng_mat/engdemo.cpp -o engdemo
Warning: You are using gcc version "4.6.1-9ubuntu3)". The version
currently supported with MEX is "4.3.4".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/
/usr/local/MATLAB/R2011b/extern/examples/eng_mat/engdemo.cpp: In function ‘int main()’:
/usr/local/MATLAB/R2011b/extern/examples/eng_mat/engdemo.cpp:107:32: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
(3)次に、実行しました:
export LD_LIBRARY_PATH=/usr/local/MATLAB/R2011b/bin/glnx86:/usr/local/MATLAB/R2011b/sys/os/glnx86
(4) 最後に、./engdemo を実行しました。出力は次のとおりです。
matlab: Command not found.
MATLAB エンジンを起動できません
MATLAB エンジンを起動するにはどうすればよいですか?