(1) Firstly, I created a Makefile as follows:
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) I ran it with 'make' command and gives following output:
/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) Then, I ran:
export LD_LIBRARY_PATH=/usr/local/MATLAB/R2011b/bin/glnx86:/usr/local/MATLAB/R2011b/sys/os/glnx86
(4) Finally, I ran ./engdemo, where the output was:
matlab: Command not found.
Can't start MATLAB engine
How can i start MATLAB engine?