On 6/20/06, Bill Baxter <[EMAIL PROTECTED]> 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]


_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to