From: Keith G. <kwg...@gm...> - 2006-06-21 14:14:24
|
On 6/20/06, Bill Baxter <wb...@gm...> wrote: > >>> a[:,num.where(v>0.5)[0]] > array([[1, 2, 4], > [6, 7, 9]]) > > I'll put that up on the Matlab->Numpy page. That's a great addition to the Matlab to Numpy page. But it only works if v is a column vector. If v is a row vector, then where(v.A > 0.5)[0] will return all zeros. So for row vectors it should be where(v.A > 0.5)[1]. Or, in general, where(v.flatten(1).A > 0.5)[1] |