-1

I want to translate a Matlab project in C++ by using Visual Studio. In my Matlab project I also have some mex file with given code. By given code I mean a .cc code with the actual code of the mex function.

How can I use that code directly in C++? I have some functions with the mx prefix which I cannot use inside Visual Studio (e.g. mxGetPr, mxGetDimensions, mxClassID).

What do I have to include or add to my project in order to use those functions? Can you give me a starting point of how to translate and use this type of code in C++?

Simon
  • 4,999
  • 21
  • 69
  • 97

2 Answers2

1

To use mex code outside of a Matlab context you would have to rewrite all the mex-specific routines in the source or replace them with non-Matlab versions. For example, everywhere that "mexPrintf" appeared in the mex code you would have to replace it with "printf" and so on.

Tyler Durden
  • 11,156
  • 9
  • 64
  • 126
0

I acknowledge that you want to use Visual Studios. As an alternative suggestion you could get a trial version of Matlab to use the function mcc to convert matlab, or mex, files to c or c++ or dotnet or, almost, whatever you want.

Everlight
  • 431
  • 5
  • 18