Re: matrix operations
- To: mathgroup at smc.vnet.net
- Subject: [mg46376] Re: [mg46354] matrix operations
- From: Yasvir Tesiram <yat at omrf.ouhsc.edu>
- Date: Mon, 16 Feb 2004 23:42:02 -0500 (EST)
- References: <200402161359.IAA20517@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
Here are some suggestions;
(* here is a 6x6 matrix*)
(mat = Array[f, {6, 6}]) // MatrixForm
(* note, I don't want mat wrapped with Head MatrixForm, hence the
paretheses*)
(* load up the MatrixManipulation package*)
Needs["LinearAlgebra`MatrixManipulation`"]
(* extract a column and Flatten it so that you can use it as a vector*)
col1 = TakeColumns[mat, {2}] // Flatten
(* suppose you want every odd column which you can use later as an
array of vectors*)
oddcols = (TakeColumns[mat, {#}] // Flatten) & /@ {1, 3, 5}
(* suppose you want a submatrix which is a 3x3 matrix on the top left*)
(submat3x3 = TakeMatrix[mat, {1, 1}, {3, 3}]) // MatrixForm
There are many other ways, using Part and Take, however I have found
the MatrixManipulation Package useful for small matrices. There are
also functions to AppendRows and Columns.
Cheers
Yas
On Feb 16, 2004, at 7:59 AM, paolo tarpanelli wrote:
> How can i extract a column from a matrix and transform that column in
> a vector to make operation with this???
>
> Thanks
>
> Paolo
>
- References:
- matrix operations
- From: "paolo tarpanelli" <tarpanelli@libero.it>
- matrix operations