Convert MATLAB Codes into Python

Is there a way to batch convert a folder of MATLAB files into Python files?

Moving this from ideas to help, as it seems more like asking for help than ideas for improving Python.

What do you mean by “convert”? What should happen when you do this? By “matlab file”, do you mean code, data or something else?

No, you cannot expect the computer to convert from code written in one programming language to another. If that were possible for a machine, and if the result were of any value, one of those two programming languages would not exist.

Be aware of the issues mentioned in this guide: NumPy for MATLAB users — NumPy v1.26 Manual

Good luck, if you try this: GitHub - victorlei/smop: Small Matlab to Python compiler or another idea from this answer A tool to convert MATLAB code to Python - Stack Overflow

2 Likes

Interesting project - I took a very quick look and saw that a main underlying library is ply, a Lex/Yacc implementation in Python by David Beazley. It’s a a really nice compiler-creation library in pure Python.
(PLY (Python Lex-Yacc)) (followed up by Sly)

1 Like

Thanks @kknechtel Karl. I mean by convert to mainly convert MATLAB codes.

That doesn’t even remotely answer the question. It simply tells me again the one thing I already understood, and ignores everything I was asking about.

1 Like