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

anirudh vij anirudhvij@gmail....
Wed Jul 9 12:59:15 CDT 2008

On Wed, Jul 9, 2008 at 7:24 PM, Isaul Vargas <isaulv@gmail.com> wrote:
> There are some issues in converting Matlab code to Python.
Tons of them infact :)
The idea is to handle the easy stuff via the script, and the harder
ones manually.

> Matlab has "dynamic arrays". Suppose you have a 1x 3 array, and you want to
> add a new row via this syntax:
> a[4,:] = b;
> This won't work in python. You will have to preallocated the array size
> somehow.
> Second, it's the 0 based indexing. Generally you shift indices by -1, but
> sometimes you may have to add a 1 to the end range .
This can be handled i think.

> Also concatenation can be a pain.
Currently using hstack and vstack
> Hope this helps.

I am working on the script right now. Will post it somewhere once the
thing starts working. Currently doing very basic stuff.
 As Pete pointed out, for a full conversion, something like ANTLR will
be needed.


More information about the SciPy-user mailing list