[Numpy-discussion] matlab to numpy help
Alex
alex.liberzon@gmail....
Sun Dec 23 17:00:14 CST 2007
if m = 5, then
Uns = ones(1,m) means 1x5 matrix(vector) of 1: [1 1 1 1 1]
Xijm(:,Uns) is called Tony's trick where you actually replicate the
Xijm (vector i guess) 5 times (according to the Uns.) e.g.
http://xtargets.com/snippets/posts/show/55
Matlab introduced repmat() function that does the job "explicitly",
using Tony's trick mostly.
Hope it helps,
Alex
On Dec 23, 7:52 pm, "Gabriel J.L. Beckers" <beck...@orn.mpg.de> wrote:
> 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
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discuss...@scipy.orghttp://projects.scipy.org/mailman/listinfo/numpy-discussion
More information about the Numpy-discussion
mailing list