[Numpy-discussion] Slicing/selection in multiple dimensions simultaneously
Jonathan Taylor
jonathan.taylor at utoronto.ca
Sat Feb 28 12:27:07 EST 2009
Hi Dave.
This does seem like the only way to write this nicely. Unfortunately,
I think this may be wasteful memory wise (in contrast to what the
obvious matlab code would do) as it constructs an array with the whole
first index intact at first. I think I will use it anyways though as
I find the other notations pretty awkward.
Jon.
On Fri, Feb 27, 2009 at 11:54 PM, David Warde-Farley <dwf at cs.toronto.edu> wrote:
>
> On 27-Feb-09, at 3:35 PM, David Warde-Farley wrote:
>>
>> a[[2,3,6],:,:][:,:,[3,2]] should do what you want.
>
> Slightly more elegantly (I always forget about this syntax):
>
> a[[2,3,6], ...][..., [3,2]]
>
> David
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
More information about the NumPy-Discussion
mailing list