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" <[EMAIL PROTECTED]> 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 > [EMAIL PROTECTED]://projects.scipy.org/mailman/listinfo/numpy-discussion _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
