1

I'm asked to write a small project in Matlab. I don't know Matlab and I don't want to learn it and I'm on Linux.

Is there a free online C++ (or python) converter to Matlab? It's a small project but the professor only knows Matlab. I know that C++ and Matlab are similar so converting syntax shouldn't be a big deal.

Please don't recommend octave, I'll have to learn Matlab syntax if I want to use it.

1
  • I don't think C++ is remotely like MATLAB. It is possible to wrap C++ up so that it is callable from MATLAB so this might minimize the amount of MATLAB necessary.
    – Eric S
    Jun 8, 2017 at 15:00

1 Answer 1

1

Using Universal-transpiler, it is possible to convert a very limited subset of C++ into equivalent Matlab code.

As an example, this is some C++ code:

double distance_formula(double x1,double y1,double x2,double y2){
    return sqrt(pow(x1-x2,2)+pow(xy-y2,2));

and this is the translator's output:

function distance_formula(x1,y1,x2,y2) 
    return sqrt(((x1-x2)^(2))+((xy-y2)^(2)));
end
3
  • I'm going to accept your answer since I'm no longer using matlab and since this this the only answer available. Thank you
    – Lynob
    Feb 28, 2018 at 9:33
  • URL of the Universal-transpiler is as below: jarble.github.io/transpiler/javascript/js_transpiler/… I pasted a small piece of C++ code into a box labelled as "Code to translate". But next what to do as there is no button for running it to get the output Code in Matlab? Mar 20, 2021 at 5:51
  • @SadiqAkbar This compiler only works with a small subset of C++, so that code might not have been translated. Mar 20, 2021 at 13:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.