[SciPy-user] Automatic MATLAB to scipy/numpy/pylab conversion

David Huard david.huard@gmail....
Wed Jul 9 08:44:06 CDT 2008


Hi,

As a ex-matlab user, I remember being in the position where I would either
1. translate matlab codes to python, 2. rewrite the whole thing Python-like.
I always ended up rewriting the code from scratch because 1. it's a great
way to learn python, and 2. there things that you can do in Python that you
don't even dream are possible in matlab, so it's worth rethinking the code
structure.

Besides, a translator that does half the job will likely be seen rather as
buggy software than as a useful tool for translation. I suggest you look at
ways to interface matlab and python to launch matlab scripts from python.

Sorry to be so pessimistic,

David


2008/7/9 anirudh vij <anirudhvij@gmail.com>:

> Hi,
>
> I have a bunch of matlab scripts that I want to convert to
> scipy/numpy/pylab. There is a nice resource at
> mathesaurus.sourceforge.net
>
> However, it is tedious and error prone to do these conversions manually.
> For eg:
>
> 1. there is no "end" in python. So all "end" statements from matlab
> need to be deleted
> 2. the syntax "for i=1:10" has to be changed to "for i in range(1,11):"
> 3. special functions from matlab need to be converted to their scipy
> equivalents.
> 4. For comments "%" must be replaced by "#"
> 5. for array scripting "(<index>)" should be replaced by "[<index>]"
> 6. Many others........
>
> To my mind these examples are prime contenders for automation. A
> reasonably small python/perl script can do the above(it will get more
> complicated ofcourse, but the principle is the same).
>
> I realize that such a script/module wont be a complete replacement. A
> human will still need to look at the output python file and edit it.
> But the script/module can remove the bullwork and leave the human
> programmer to do more productive stuff.
>
> Is there a pre-existing project that accom,plishes this kind of stuff.
> If not, I would like to start one. Feedback/Suggestions will be very
> helpful.
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20080709/95fb43ed/attachment.html 


More information about the SciPy-user mailing list