As my title clearly tells that I need a software or an online tool to convert a given Python code into Matlab code. The resultant Matlab code does not need to be very efficient, I just need a working code. I can try to optimize it on my own.

Note: I know that we can run Python scripts from Matlab, however, in my case, I need Matlab code.

  • What libraries does the Python code use? Please list all of the import statements, thanks! If your code starts with import tensorflow then converting it to Matlab will not be possible, for instance. – Nicolas Raoul Dec 17 '18 at 7:12
  • 1
    I don't know of any "transpilers" that convert python code by "cut and paste", like the babeljs online repl does for converting modern Javascript to old, backwards-compatible Javascript. However, there is a Cheat Sheet that compares the syntax of Matlab and Python in a side-by-side view, using lots and lots of one-line code-examples. Hope this helps. By the way, do you know any language that can be automatically transpiled to Matlab/Octave? – knb Dec 17 '18 at 9:34
  • 1
    @NicolasRaoul Currently, I do not import any libraries. They are very basic, simple small scripts. – one Dec 18 '18 at 8:07
  • @knb Thanks for the link, that cheat sheet might be very helpful. Unfortunately, I do not know such transpilers, I am a newbie about Matlab. – one Dec 18 '18 at 8:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.