[Numpy-discussion] Selecting columns of a matrix (original) (raw)
Alan G Isaac aisaac at american.edu
Wed Jun 21 04:48:15 EDT 2006
- Previous message (by thread): [Numpy-discussion] Selecting columns of a matrix
- Next message (by thread): [Numpy-discussion] Selecting columns of a matrix
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 20 Jun 2006, Keith Goodman apparently wrote:
I have a matrix M and a vector (n by 1 matrix) V. I want to form a new matrix that contains the columns of M for which V > 0. One way to do that in Octave is M(:, find(V > 0)). How is it done in numpy?
M.transpose()[V>0] If you want the columns as columns, you can transpose again.
hth, Alan Isaac
- Previous message (by thread): [Numpy-discussion] Selecting columns of a matrix
- Next message (by thread): [Numpy-discussion] Selecting columns of a matrix
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]