Re: partition of 2D arrray
- To: mathgroup at smc.vnet.net
- Subject: [mg49174] Re: [mg49137] partition of 2D arrray
- From: "camartin at snet.net" <camartin at snet.net>
- Date: Tue, 6 Jul 2004 03:33:44 -0400 (EDT)
- References: <200407050854.EAA14710@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Kumar,
Using the DataManipulation package is the easiest way to do this.
In[19]:=
FF={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}}
Out[19]=
{{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}}
In[20]:=
FF//MatrixForm
In[26]:=
Needs["Statistics`DataManipulation`"]
In[27]:=
xx=ColumnTake[FF,2]
Out[27]=
{{1,2},{5,6},{9,10},{13,14}}
You can also use the Transpose command then select the rows but as the
package exists you may as well use it. For viewing purposes in
Mathematica use the //MatrixForm to see that what we did was correct.
Good luck.
Cliff
Ravinder Kumar B. wrote:
>Dear Friends,
>I have a list of 2D data of the following form:
>{{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}};
>In MatrixForm it is 4x4 matrix.
>How do I extract the fisrt two column of the data from the above matrix.
>i.e.,
>{{1,2},{5,6},{9,10},{13,14}}
>
>
>
>
- References:
- partition of 2D arrray
- From: "Ravinder Kumar B." <ravi@crest.ernet.in>
- partition of 2D arrray