Test Matlab C and C++ MEX

These commands are all from within Matlab. They demonstrate that Matlab (or GNU Octave) MEX C / C++ compiler wrapper is working on your system.

  1. Copy the Matlab example code:

    copyfile(fullfile(matlabroot,'extern','examples','mex','yprime.c'), pwd)
  2. in Matlab or GNU Octave compile the callable C-code by:

    mex yprime.c
  3. use the compiled C-code function from Matlab or Octave by:


    which returns

    ans = 2.0000 5.9924 1.0000 2.986


if you get missing compiler errors, do Mex setup