[Numpy-discussion] Matlab page on scipy wiki

Stefan van der Walt stefan at sun.ac.za
Fri Feb 10 04:24:01 CST 2006


On Thu, Feb 09, 2006 at 05:21:10PM +0900, Bill Baxter wrote:
> I added some content to the "NumPy/SciPy for Matlab users" page on the scipy
> wiki.
> 
> But my knowledge of NumPy/SciPy isn't sufficient to fill in the whole chart of
> equivalents that I laid out.

One of my colleagues also asked about the shortest way to do array
concatenation.

In Octave that would be

[1, 0, 1:4, 0, 1]

Using numpy we currently do

concatenate([[1, 0], arange(1,5), [0, 1]]) or
vstack(...)

The "+" operator now means something else, so you can't do

[1,0] + arange(1,5) + [0,1], while

[1, 0, arange(1,5), 0, 1] produces

[1, 0, array([1, 2, 3, 4]), 0, 1]

which can't be converted to an array by simply doing

array([[1, 0, array([1, 2, 3, 4]), 0, 1]])

I'll add it to the wiki once I know what the best method is.

Regards
Stéfan




More information about the Numpy-discussion mailing list