Open Thoughts

May 2009 archive

Matlab to Python

May 6, 2009

I came across the OMPC (one MATLAB per child) project yesterday. No, it isn't a non-profit organisation that is handing out Matlab licenses so that kids in developing countries can enjoy programming. It is an automatic translator from Matlab to Python. It tries to preserve the matlab flavour of the code, so you can carry on writing matlab like code in python. The magic is made possible by python decorators and introspection.

Those python fans out there will throw up their hands in horror ("that's so unpythonic"), but for people who just want to get the job done, it is not bad at all. Also, some useful bits of matlab syntax may become python standards in future, such as the .* operator.

A simple test with arffload.m from our dataformat project crashed at first try. Google app engine didn't like the umlaut in my institution name. After converting Zürich to Zurich, everything worked happily.