[Numpy-discussion] matlab to numpy help

Gabriel J.L. Beckers beckers at orn.mpg.de
Sun Dec 23 12:52:38 EST 2007


I found a matlab script that I want to translate into numpy, but have
difficulties with understanding indexing in matlab. I haven't used
matlab very much and I was hoping that someone could help with the
following:

It says:

	Uns = ones(1,m);
	
... and then later

	Xijm(:,Uns);


m is a positive integer. The problem is that Xijm should be a
1-dimensional array (I think), so what is Uns doing in the second
statement? Is this some way to expand Xijm into a second dimension? What
would be a numpy equivalent?

Gabriel





More information about the NumPy-Discussion mailing list