How to convert cpp file to .m file ?


Joined Feb 24, 2006
I don't think there is an automated solution. Converting it by hand is about your only option. There are many concepts in C++ that have no resonable expression in Matlab, and vice versa. On top of that are the differences between compiled and interpreted languages. Matlab is "built" for matrix manipulation; a for loop produces execrable results.


Joined Nov 25, 2011
C++ to matlab
I think it's pretty much just trying to boil the C/C++ code down to pseudo code and then trying to rewrite it MATLAB. Sounds like you're much more familiar with the MATLAB language than C/C++, so maybe you can extract the gist of the C code?

Alternatively, you can look into using the C/C++ code as the basis for creating a MEX file where you just call the algorithm in MATLAB.

Hope this helps, And sorry I can't offer anything more concrete.