Matlab C and C++ MEX setup

Test that Matlab MEX C / C++ compiler wrapper is working on your system with a supported compiler. These commands are all from within Matlab.

Setup Matlab with C and C++ compilers by:

mex -setup -v C
mex -setup -client engine C

mex -setup -v C++
mex -setup -client engine C++

mex -setup -v Fortran
mex -setup -client engine Fortran

Verify configuration by:

mex.getCompilerConfigurations('C')

mex.getCompilerConfigurations('C++')

Copy the Matlab example code:

copyfile(fullfile(matlabroot,'extern','examples','mex','yprime.c'), pwd)

Compile:

mex yprime.c

Run

yprime(3,[4,2,7,1])

ans = 2.0000 5.9924 1.0000 2.986

MEX troubleshooting