I'm trying to build and run the Matlab Engine example "engdemo.c" using the instructions from Mathworks. When I try to run it with the command !./engdemo
, I'm getting the following error:
matlab: Command not found.
Can't start MATLAB engine
I have not found a solution to this in other relevant StackOverflow posts (e.g. matlab engine “Can't start MATLAB engine" or How solve the “Can't start MATLAB engine” command? [closed])
I have csh installed at /bin/csh (checked this by typing which csh
).
I have Matlab on my PATH variable, and I have set the DYLD_LIBRARY_PATH variable according to the Mathworks instructions for Mac OSX. Here are the lines I have included in my .bash_profile to set these environment variables:
# Settings for Matlab Engine using Apple XCode
export PATH=$PATH:/Applications/MATLAB_R2014a.app/bin
export PATH=$PATH:/Applications/MATLAB_R2014a.app/bin/maci64
export DYLD_LIBRARY_PATH=/Applications/MATLAB_R2014a.app/bin/maci64:/Applications/MATLAB_R2014a.app/sys/os/maci64:$DYLD_LIBRARY_PATH
Ultimately I would like to build a C program that uses Matlab scripts (ideally building with XCode), but it's frustrating to have trouble even getting the demo to work.