2

(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 引擎?

4

0 回答 0