How to convert cpp file to .m file ?

Discussion in 'Programmer's Corner' started by tojeena, Feb 3, 2012.

  1. tojeena

    Thread Starter Active Member

    May 2, 2009
    118
    0
    Hi friends,

    I need to convert one cpp file to matlab ..Is there any solution
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    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.
     
  3. holnis

    Member

    Nov 25, 2011
    50
    4


    I am not sure what you mean when you said "convert to matlab" !

    do you plan on rewriting your C++ code, or creating MEX files?


    :)
     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    Seemed pretty clear to me, but only the OP can know for sure.
     
  5. tojeena

    Thread Starter Active Member

    May 2, 2009
    118
    0
    C++ to matlab
     
  6. stahta01

    Member

    Jun 9, 2011
    133
    21
    I would NOT expect any help; till you choice a way to proceed.

    Tim S.
     
  7. holnis

    Member

    Nov 25, 2011
    50
    4
    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.
     
Loading...