2

I want to code and build Matlab mex files on Eclipse IDE. How could I do to include mex compiler as one of the c++/c compilers and build the mex code I have with that compiler on Eclipse?

erogol
  • 13,156
  • 33
  • 101
  • 155

2 Answers2

1

I don't know what you are trying to say but I'll explain how mex helped me.

  1. Mex is - Matlab Executable this you'd be using to create the functions similar to Matlab functions Ex: function varargout = foo(varargin). This foo will be your foo.c or foo.cpp.
  2. The foo.c or cpp is compiled with the well known C/C++ Compilers mentioned here -http://www.mathworks.in/support/compilers/R2012a/win64.html
  3. This generates a foo.mexw32 or foo.mexw64 in Windows and you can call it like a Matlab Function.
  4. What you can do is write a code in Eclipse using the C compiler it has get it execute and port it to mex functions easily. Select the compilers from mex -setup

I found this tutorial extremely helpful : Mex Tutorial

and I doubt there is something call "Mex compiler" atleast I've not come across.

Sridutt
  • 382
  • 3
  • 14
1

I use the tutorial of http://ngoonee.xanga.com/664222870/compiling-mexw32-mex-for-windows-files-using-eclipse-cdt-ide-mingw-gcc-compiler/

Works for me!

erogol
  • 13,156
  • 33
  • 101
  • 155
  • The link is dead. Probably it will be similar for what should be done in Visual Studio - https://www.mathworks.com/help/matlab/matlab_external/compiling-mex-files-with-the-microsoft-visual-c-ide.html. See http://stackoverflow.com/questions/6611538/how-to-compile-a-mex-file. – Royi Feb 24 '17 at 10:54