[SciPy-User] Numpy/MATLAB difference in array indexing

Pauli Virtanen pav@iki...
Sun Mar 18 17:37:34 CDT 2012

18.03.2012 23:18, federico vaggi kirjoitti:
> I was trying to port some code from MATLAB to Scipy, and I noticed a
> slight bug in the functionality of numpy.tile vs repmat in matlab:
> For example:
> a = np.random.rand(10,2)
> b = tile(a[:,1],(1,5))

a[:,1] is an 1-d array, and therefore considered as a (1, N) vector in
2-d context. This is not a bug --- the Numpy constructs do not always
map exactly to Matlab ones.

Pauli Virtanen

More information about the SciPy-User mailing list